LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Bug Reports > [Resolved] Chunked HTTP/1.1 POST request support

Reply
 
Thread Tools Display Modes
  #1  
Old 06-26-2010, 03:53 PM
ritchey ritchey is offline
New Member
 
Join Date: Jun 2010
Posts: 5
Exclamation [Resolved] Chunked HTTP/1.1 POST request support

I've noticed that LSWS doesn't support Chunked HTTP/1.1 POST requests. Such behavior seems to be HTTP/1.1 incompatible. HTTP/1.1 RFC (see RFC 2616, section 3.6.1) states clearly:

"All HTTP/1.1 applications MUST be able to receive and decode the "chunked" transfer-coding, (...)"

Today, major part of mobile devices sends CHUNKED HTTP requests, when posting large data (above 5 KB). For example Apache server handles such requests perfectly.

Any explanation to this behaviour ?

Last edited by NiteWave; 06-28-2010 at 03:17 AM..
Reply With Quote
  #2  
Old 06-27-2010, 01:30 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
Chunked POST request should be supported. Can you provide a simple example request including request header and chunked body, please send it to bug@litepseed... We will fix it if it is a bug or a situation not handled properly.
Reply With Quote
  #3  
Old 06-27-2010, 03:15 PM
ritchey ritchey is offline
New Member
 
Join Date: Jun 2010
Posts: 5
Default Test scenario for Chunked HTTP/1.1 POST

Sample chunked POST request:
Code:
POST /test.php HTTP/1.1
User-Agent: Profile/MIDP-2.0 Configuration/CLDC-1.1
Host: 127.0.0.1
Transfer-Encoding: chunked

6
Hello_
5
World
0
// after last '0' there are two times CRLF, so the last 5 bytes are: 0x30, 0x0D, 0x0A, 0x0D, 0x0A
Above request is attached as text file to this post.

And here is the test.php:
PHP Code:
<?php
    $in 
fopen('php://input''r');
    
$text fread($in100);
    
$size strlen($text);
    echo 
"Text: $text<br/>";
    echo 
"Size: $size<br/>";    
?>
On Apache 2.2.11 it gives following response:
Code:
HTTP/1.1 200 OK
Date: Sun, 27 Jun 2010 22:04:27 GMT
Server: Apache/2.2.11 (Win32) PHP/5.3.0
X-Powered-By: PHP/5.3.0
Content-Length: 38
Content-Type: text/html

Text: Hello_World<br/>Size: 11<br/>
I also tested this POST request on Tomcat and Jetty - works perfectly - we recive request with its content.
(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:
Code:
HTTP/1.1 200 OK
Date: Sun, 27 Jun 2010 22:02:54 GMT
Server: LiteSpeed
Connection: close
X-Powered-By: PHP/5.2.8
Content-Type: text/html
Content-Length: 26

Text: <br/>Size: 0<br/>
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.
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.

Best Regards,
Mateusz Maksymiuk
Attached Files
File Type: txt chunked_post.txt (151 Bytes, 1 views)
Reply With Quote
  #4  
Old 06-27-2010, 09:54 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
Thanks for the detail test case, we successfully identify the bug and fixed it. It was the length of request body not being passed to PHP properly.
Fix is in our 4.0.16 build, just change the version number in the download link to get it.
Reply With Quote
  #5  
Old 06-28-2010, 02:19 AM
ritchey ritchey is offline
New Member
 
Join Date: Jun 2010
Posts: 5
Mistwang - Thank You very much for Your reply. You have incredibly fast reaction time - in less than one day - You have released fixed version.
It's the highest possible Quality of Service.

Best Regards,
Mateusz Maksymiuk
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:52 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.