[Resolved] Chunked HTTP/1.1 POST request support
2012-03-12 15:05
218 查看
[Resolved] Chunked HTTP/1.1 POST request support - LiteSpeed Support Forums
Code:
Above request is attached as text file to this post.
And here is the test.php:
PHP Code:
On Apache 2.2.11 it gives following response:
Code:
(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:
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.
[Resolved] Chunked HTTP/1.1 POST request support - LiteSpeed Support Forums
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($in, 100); $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.
相关文章推荐
- wp7使用POST请求Asp.net网页时,HttpWebRequest的BeginGetResponse方法抛出NotSupportException异常的解决方法
- The type javax.servlet.http.HttpServletRequest cannot be resolved. 解决方案
- .Net使用HttpWebRequest构造POST请求(带文件)_备忘
- C#利用HttpWebRequest,Stream,HttpWebResponse,StreamReader获取post返回的数据
- HTTP Request的Get、Post的区别
- The type javax.http.HttpServletRequest cannot be resolved.It is indirectly
- HttpWebRequest post 提交 C#的WebBrowser操作frame如此简单 WebClient 提交
- The type javax.servlet.http.HttpServletRequest cannot be resolved
- C#实现通过HttpWebRequest发送POST请求实现网站自动登陆
- 使用 HttpWebRequest 发送模拟 POST 请求
- The type javax.servlet.http.HttpServletRequest cannot be resolved. It is indirectly referenced from
- C#通过WebClient/HttpWebRequest实现http的post/get方法
- The type javax.servlet.http.HttpServletRequest cannot be resolved. It is indirectly referenced from required .class files
- 使用 HttpRequest Get和Post调用其他页面
- The type javax.servlet.http.HttpServletRequest cannot be resolved. It is indirectly reference 问题之解决
- The type javax.servlet.http.HttpServletRequest cannot be resolved
- 使用JavaScript的XMLHttpRequest发送POST、GET请求以及接收返回值
- ASIHTTPRequest和ASIFormDataRequest 区别,GET和POST
- Spring学习笔记(二十三):关于STS提示"javax.servlet.http.HttpServletRequest cant be resolved"的问题