<div><font face="verdana,sans-serif">>>What's the actual length of $auth_value? If it's not<br>>>AUTHENTICATION_COOKIE_LEN (32, I think), that's when I'd expect that<br>>>error.<br></font></div>
<div><font face="verdana,sans-serif">Thanks, Nick. The length of $auth_value is 32 though, and the length of bin2hex($auth_value) is 64.</font></div>
<div><font face="verdana,sans-serif"></font> </div>
<div><font face="verdana,sans-serif">>>Also, I don't know PHP so well, but maybe you should specify 'rb'<br>>>instead of 'r'.<br></font></div>
<div><font face="verdana,sans-serif">I do not see that 'rb' is an option in php for the fopen() function ...</font></div>
<div><br clear="all"><font face="verdana,sans-serif">. . . . .<br>Wesley <br></font><br></div>
<div class="gmail_quote">On Tue, Oct 21, 2008 at 2:57 PM, Nick Mathewson <span dir="ltr"><<a href="mailto:nickm@freehaven.net">nickm@freehaven.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>
<div></div>
<div class="Wj3C7c">On Tue, Oct 21, 2008 at 11:52:33AM -0700, Wesley Kenzie wrote:<br>> per 5.1 Authentication in control-spec.txt: "To authenticate, the controller<br>> must send the contents of this file, encoded in hexadecimal."<br>
><br>> Fine, but when using the following in PHP:<br>><br>> $ch = fopen('cookiefilename', 'r');<br>> $auth_value = fread($ch, 128);<br>> $send_auth_value = "AUTHENTICATE \"". bin2hex($auth_value) . "\"\r\n";<br>
> $fh = fsockopen('<a href="http://127.0.0.1/" target="_blank">127.0.0.1</a>', controlportnumber);<br>> fwrite($fh, $send_auth_value);<br>> $buf = fgets($fh);<br>><br>> ... I get 515 Authentication failed: Wrong length on authentication cookie.<br>
<br></div></div>What's the actual length of $auth_value? If it's not<br>AUTHENTICATION_COOKIE_LEN (32, I think), that's when I'd expect that<br>error.<br><br>Also, I don't know PHP so well, but maybe you should specify 'rb'<br>
instead of 'r'.<br><br>--<br><font color="#888888">Nick<br></font></blockquote></div><br>