0

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()
)
4

1 回答 1

1

HttpClient 完全支持块编码。您收到此异常是因为服务器发送的响应消息格式错误。

于 2013-10-25T12:53:27.173 回答