akka/akka-http

Review documentation about discarding entity bytes for the server-side

開放

#817 建立於 2017年1月24日

 (1 則留言) (0 個反應) (0 位負責人)Scala (598 個分叉)batch import
1 - triagedhelp wantedt:docs

倉庫指標

星標
 (1,311 顆星)
PR 合併指標
 (平均合併 1天 10小時) (30 天內合併 2 個 PR)

描述

As already documented, discarding response entity bytes is required on the client, otherwise, the connection will stall after some time. This is a somewhat significant problem because clients often don't expect (or aren't interested) in the response bodies of non-200 responses that often contain just informational messages. This cannot be solved automatically because akka-http cannot detect when user code has finished processing a response.

On the server-side, however, discarding request entity bytes should never be needed. It can usually considered a bug

  • either, by the client of sending a request body, when none was expected
  • or, on the server where a request body was not accidentally not consumed

Both situations are not common. Fortunately, it can be detected when a request entity was not read. The current behavior in those situations is to close the connection after the response was sent (which seems to be fine in such an uncommon situation).

Optionally, we could provide another automatic solution where the request body is drained automatically. This is the topic of related ticket #183.

貢獻者指南