org.apache.http.impl.client.DefaultHttpClient是否支持分块编码?
我无法弄清楚为什么我总能得到这个:
org.apache.http.TruncatedChunkException: Truncated chunk ( expected size: 16384; actual size: 13532)
Scala代码块:
val method = new HttpGet(uri)
val client = new DefaultHttpClient()
val response = client.execute(method)
Option(response.getEntity).foreach(
body => {
io.Source.fromInputStream(body.getContent).
getLines().foreach(line => doStuff(line))
}
response.getEntity.getContent.close()
)
答案 0 :(得分:0)
HttpClient完全支持块编码。您收到此异常是因为服务器发送的响应消息格式不正确。