开发者

[Android]HttpClient post/put StringEntity length limit?

I'm seeing a problem with the HttpClient posting/putting a long开发者_JS百科 StringEntity. When the entity is short, there is no problem at all. However, when the length exceeds a value (something around 1400 characters), the http packet can never be sent out (I sniffed the interface using WireShark). Actually, the connection is established, but the data is not transmitted, so the receiver side got a timeout exception. I'm wondering if these is a lenght limit. I tried to increase the connection timeout and socket timeout, which only made me wait longer to see the timeout ... And i also tried to use InputStreamEntity, didn't work either.

[Update]: I tried to used HttpURLConnection directly instead of HttpClient. The same problem still exists. However, I do have some findings. When I forced the packet to be cut into chunks (using HttpURLConnection.setChunkedStreamingMode), WireShare did captured some segment of the packet, with the previous segments missing. I guess this must be a bug in the apache http library.


The issue is resolved. It took me several days to find out that, the problem is with my wireless router. It has some weird settings which truncates large incoming http messages.


It is possible it is timing out on the server side. Also make sure you are using the org.apache.client.httpclient jar. Officially there is no max length for a url. Look here http://www.w3.org/Protocols/rfc2616/rfc2616.html


I think that can help you urllength

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜