akka/akka-http

Review documentation about discarding entity bytes for the server-side

Open

#817 opened on Jan 24, 2017

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Scala (598 forks)batch import
1 - triagedhelp wantedt:docs

Repository metrics

Stars
 (1,311 stars)
PR merge metrics
 (Avg merge 1d 10h) (2 merged PRs in 30d)

Description

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.

Contributor guide