Skip to content

You're viewing documentation for a pre-release version. View the latest stable version

Instance Property

maxDrainBytes

How many bytes of an unread request body the server will drain to keep the connection alive. Past this the drain stops and the connection is closed instead of reading on — a DoS guard. Defaults to 16 KB.
var maxDrainBytes: Int

Discussion

The budget applies only to the bytes this drain reads, not to what the handler already consumed: a handler that deliberately read a large body and left a small remainder still gets its connection reused, while an unconsumed body larger than this is drained up to the budget and then the connection is closed.