Request to W2k3 with IIS6....
| From: | Ron | Date: | Thu, 08 Apr 2004 20:07:02 +0000 |
| Subject: | Request to W2k3 with IIS6.... | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-27206@lists.php.net to get a copy of this message | ||
I've got some code working gainst IIS5. now some servers have been
upgraded to IIS6, and my code is not working anymore.. I'm using the
PHP-Pear client, of course.
What's the problem?
The request $code =
$this->HTClient->post('http://www10.hattrick.org/Common/default.asp',
array('loginname' => $username, 'password' => $password,
'action' =>
'login')); should result in a code 200. It does on IIS5, but doesn't on
IIS6. There I got a code 400..
Actions taken?
Searching on the MS website, did result in finding an Q&A on this topic:
Q. I have a Web application that worked fine with IIS 5.0, but after
upgrading to IIS 6.0, I am getting "400 Bad Request" errors. What is
causing this?
A. The Web application might be generating requests that end with a
carriage return/linefeed (\n). According to RFC2616, such requests are
malformed. IIS 5.0 ignored the carriage return/linefeed and processed
requests ending with \n successfully. IIS 6.0, however, follows RFC 2616
strictly, generating an error if a request ends with \n. To stop
receiving 400 errors, modify our application so that requests do not
contain \n.
Searching the web more, did me find a solution to this problem:
(http://www.phpclasses.org/browse/package/576.html)
<http://www.phpclasses.org/browse/package/576.html>
The code would be:
$tab_ip = "www10.hattrick.org";
$s = @fsockopen($tab_ip,"80");
$arg = "loginname=LOGIN&password=PASSWORD&action=login";
fputs($s, "POST /Common/default.asp HTTP/1.1\r\n");
fputs($s, "Host: ".$tab_ip."\r\n");
fputs($s, "Content-Type: application/x-www-form-urlencoded\r\n");
fputs($s, "User-Agent: HT-Arena v2\r\n");
fputs($s, "Accept: */*\r\n");
fputs($s, "Connection: Close\r\n");
fputs($s, "Content-Length: ".strlen($arg)."\r\n\r\n");
fputs($s, "$arg");
fclose($s);
However this code solves my problem, implementing this code, would not
be preferred by me..
Does anybody have a solution for this problem? I've anylized the
request.php already, and it seems that (at line 732) the problem should
be solved.. However, changing some of that code (to test) didn't solve
the problem :-( I'm feeling a bit silly now :-)
Let me know your answers!
/Ron