ID: 9280
Updated by: andy
Reported By: [EMAIL PROTECTED]
Old Status: Closed
Status: Open
Bug Type: Apache related
Operating System: Linux
PHP Version: 4.0.4pl1
New Comment:

[EMAIL PROTECTED] emailed me with his response.  I am
re-opening this bug.  This is what he said...
-------------------------------------------------------

First I created a simple PHP script which does nothing.  I've
called it "null.php" and it's in the root of my servers.  It
contains simply:

<BODY> hello
</BODY>  Now to test, I telnet to the web server port.
First I connect to
the machine with a stock PHP (4.0.4pl1) on it, and paste in the
following:

POST /null.php HTTP/1.1
Host: yellow.datatote.co.uk
Content-Type: application/x-www-form-urlencoded
Content-Length: 3
Accept: */*
Expect: 100-continue

Now I add an extra blank line after the Expect: header.  Nothing
happens.

Next I connect to the machine with my modified PHP on it, and
paste in:

POST /null.php HTTP/1.1
Host: etweb_qa.datatote.co.uk
Content-Type: application/x-www-form-urlencoded
Content-Length: 3
Accept: */*
Expect: 100-continue

Now I add an extra blank line after the Expect: header.  The
web server responds with:

HTTP/1.1 100 Continue

This is as per the HTTP 1.1 spec (RFC 2068, section 8.2).

To check that this behaviour is definitely PHP related, I
created
a dummy perl script (similar to the PHP one above) and return to
the http port of the original machine (with unmodified PHP) and
paste in:

POST /cgi-bin/null.pl HTTP/1.1
Host: yellow.datatote.co.uk
Content-Type: application/x-www-form-urlencoded
Content-Length: 3
Accept: */*
Expect: 100-continue

Adding an extra blank line after the Expect: produces the
correct
"HTTP/1.1 100 Continue" line.

This may not be quite what you wanted, but it should give you
all the information you need to see the fault and to see
that the
fix works.

Note that the two servers mentioned above are not publically
accessible (sorry - development machines).  I can provide public
access to a null.php on a box with my patched PHP if that is any
help.

Also,  we originally spotted this bug because someone was trying
to use a standard URL fetch method using JRE 1.3 (I'm not a Java
programmer so I don't know offhand what the method was).




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

[2001-07-22 12:49:35] [EMAIL PROTECTED]

no feedback after 38 days.

------------------------------------------------------------------------

[2001-06-14 20:45:53] [EMAIL PROTECTED]

Do you have any example script that can be used to reproduce
this behaviour? (I'm being lazy here.. :)



------------------------------------------------------------------------

[2001-02-15 09:10:32] [EMAIL PROTECTED]

When a PHP page is requested via HTTP/1.1, and the HTTP
header "Expect: 100-continue" is supplied, PHP does not
honour the request.  This is because it is failing
to call ap_should_client_block().

The file sapi/apache/mod_php4.c needs modification. The
following change has been tested and works. Hopefully
someone can make sense of this diff output:

--- sapi/apache/mod_php4.c   Wed Jan  3 22:07:59 2001
+++ sapi/apache_modified/mod_php4.c  Thu Feb 15 13:56:12 2001
@@ -159,14 +159,16 @@
        void (*handler)(int);

        handler = signal(SIGPIPE, SIG_IGN);
-       while (total_read_bytes<count_bytes) {
-               hard_timeout("Read POST information", r); /* start timeout timer
-               read_bytes = get_client_block(r, buffer+total_read_bytes, 
count_bytes-total_read_bytes);
-               reset_timeout(r);
-               if (read_bytes<=0) {
-                       break;
+       if (ap_should_client_block(r)) {
+               while (total_read_bytes<count_bytes) {
+                       hard_timeout("Read POST information", r); /* start timeout 
+timer */
+                       read_bytes = get_client_block(r, buffer+total_read_bytes, 
+count_bytes-total_read_bytes);
+                       reset_timeout(r);
+                       if (read_bytes<=0) {
+                               break;
+                       }
+                       total_read_bytes += read_bytes;
                }
-               total_read_bytes += read_bytes;
        }
        signal(SIGPIPE, handler);
        return total_read_bytes;     


------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=9280&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to