06-27-2010, 04:15 PM
Join Date: Jun 2010
Test scenario for Chunked HTTP/1.1 POST
Sample chunked POST request:
// after last '0' there are two times CRLF, so the last 5 bytes are: 0x30, 0x0D, 0x0A, 0x0D, 0x0A
POST /test.php HTTP/1.1
User-Agent: Profile/MIDP-2.0 Configuration/CLDC-1.1
Above request is attached as text file to this post.
And here is the test.php:
On Apache 2.2.11 it gives following response:
$in = fopen('php://input', 'r');
$text = fread($in, 100);
$size = strlen($text);
echo "Text: $text<br/>";
echo "Size: $size<br/>";
I also tested this POST request on Tomcat and Jetty - works perfectly - we recive request with its content.
HTTP/1.1 200 OK
Date: Sun, 27 Jun 2010 22:04:27 GMT
Server: Apache/2.2.11 (Win32) PHP/5.3.0
Text: Hello_World<br/>Size: 11<br/>
(When testing it on Apache or other servers - remember not to use any proxies like Squid, cause they usually also don't support chunked POSTs).
Unfortunetly, on LSWS the PHP $text variable leaves empty:
No data is read from "php://input". The strange thing is LSWS doesn't abort request at the begining by returing some 4xx or 5xx error - not at all. LSWS accepts the request, passes it to PHP file but drops posted content. The retured code is HTTP 200.
HTTP/1.1 200 OK
Date: Sun, 27 Jun 2010 22:02:54 GMT
Text: <br/>Size: 0<br/>
All seems to be perfect but we cannot access chunked request body from PHP file.
Such requests as above are produced by major part of today mobile devices when POST-ing large data (above 5 KB). So now, using LSWS server we cannot upload files to server from large number of mobile phones.
I will also post this info to bug@litespeed... as You suggested.