[PHP-DEV] PHP 4.0 Bug #7373 Updated: PHP fails with error 0 in fopen() on some URLs that IE & Netscape can From: stas <email protected>
Date: 10/30/00

ID: 7373
Updated by: stas
Reported By: david <email protected>
Status: Closed
Bug Type: HTTP related
Assigned To:
Comments:

I guess this is not PHP bug - standard clearly says there should be a space.

Previous Comments:
---------------------------------------------------------------------------

[2000-10-20 16:04:29] david <email protected>
Two issues:

Issue [1]:
     Some URLS (eg those served by the Java Server Pages
     engine contributed to apache by sun, now called
     jakarta-tomcat) fail to fopen() from PHP 3 and 4 when IE
     and Netscape can open them without a problem. This
     is not strictly a PHP problem, but it is very easy to make
     PHP be a little more tolerant in this area. I've included
     a fix below:- please check it for me!!

     I checked the HTTP spec and it seems that the cause of
     the problem is that jakarta-tomcats reports an HTTP status line
     that looks like "HTTP/1.1 200" and DOES NOT include a
     space character after the 200 which according to the
     spec [quoted below] likely should. This breaks PHP, and PHP's
     error reporting in this situation is pretty abysmal.

>From the HTTP spec:
   ----------------------------------------------------------------------------------------
   6.1 Status-Line

   The first line of a Response message is the Status-Line, consisting
   of the protocol version followed by a numeric status code and its
   associated textual phrase, with each element separated by SP
   characters. No CR or LF is allowed except in the final CRLF sequence.

       Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
   ----------------------------------------------------------------------------------------

I have a solution to this problem, in main/fopen-wrappers.c
in the portion of code where it reads the HTTP response from the server.

The relevant code fragment processes the "HTTP/1.x 200....." response
received from the server.

608,610c608,617
< if (strncmp(tmp_line + 8, " 200 ", 5) == 0) {
< reqok = 1;
< }

---
>             if (strncmp(tmp_line + 8, " 200", 4) == 0) {
>                 if(tmp_line[12] == '

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>