Date: 10/20/00
- Next message: fmk <email protected>: "[PHP-DEV] PHP 4.0 Bug #7088 Updated: mssql_fetch_row"
- Previous message: fmk <email protected>: "[PHP-DEV] PHP 4.0 Bug #7297 Updated: mssql_fetch_object"
- Next in thread: Alan van den Bosch: "Re: [PHP-DEV] PHP 4.0 Bug #7373: PHP fails with error 0 in fopen() on some URLs that IE & Netscape can"
- Reply: Alan van den Bosch: "Re: [PHP-DEV] PHP 4.0 Bug #7373: PHP fails with error 0 in fopen() on some URLs that IE & Netscape can"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: david <email protected>
Operating system: Solaris 2.6
PHP version: 4.0.2
PHP Bug Type: HTTP related
Bug description: PHP fails with error 0 in fopen() on some URLs that IE & Netscape can
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] == '\0' || isspace(tmp_line[12]))
> reqok = 1;
> else
> php_error(E_WARNING,
> "Invalid HTTP response received: %s", tmp_line);
> } else {
> php_error(E_WARNING,
> "Invalid HTTP response received: %s", tmp_line);
> }
Issue [2]:
I noticed this issue when chasing [1]. The replacement code I am offering
in [1] does not correct this problem.
The usage of tmp_line + 8 seems to violate the HTTP 1.1 spec, because for
an example, it would be quite valid for them to introduce a new HTTP
version "1.11" before "1.2" and this would break PHP because the status code
would be at tmp_line + 9 instead of tmp_line + 8.
0123456789 [tmp_line index, view this with non-proportional font]
HTTP/1.1 200
HTTP/1.11 200
--
Edit Bug report at: http://bugs.php.net/?id=7373&edit=1
--
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>
- Next message: fmk <email protected>: "[PHP-DEV] PHP 4.0 Bug #7088 Updated: mssql_fetch_row"
- Previous message: fmk <email protected>: "[PHP-DEV] PHP 4.0 Bug #7297 Updated: mssql_fetch_object"
- Next in thread: Alan van den Bosch: "Re: [PHP-DEV] PHP 4.0 Bug #7373: PHP fails with error 0 in fopen() on some URLs that IE & Netscape can"
- Reply: Alan van den Bosch: "Re: [PHP-DEV] PHP 4.0 Bug #7373: PHP fails with error 0 in fopen() on some URLs that IE & Netscape can"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

