NIOHTTPServerRequestAggregator

A ChannelInboundHandler that handles HTTP chunked HTTPServerRequestPart messages by aggregating individual message chunks into a single NIOHTTPServerRequestFull.

NIOHTTPObjectAggregator.swift:180
final class NIOHTTPServerRequestAggregator

This is achieved by buffering the contents of all received HTTPServerRequestPart messages until HTTPServerRequestPart.end is received, then assembling the full message and firing a channel read upstream with it. It is useful for when you do not want to deal with chunked messages and just want to receive everything at once, and are happy with the additional memory used and delay handling of the message until everything has been received.

NIOHTTPServerRequestAggregator may end up sending a HTTPResponseHead:

  • Response status 413 Request Entity Too Large when either the content-length or the bytes received so far exceed maxContentLength.

NIOHTTPServerRequestAggregator may close the connection if it is impossible to recover:

  • If content-length is too large and keep-alive is off.

  • If the bytes received exceed maxContentLength and the client didn’t signal content-length