<div dir="ltr">I&#39;d like to make an addition to the WAI protocol: a field in the Request data type to track the request body size. I would like this to be:<div><br></div><div style>    requestBodyLength :: Maybe Word64</div>

<div style><br></div><div style>I think the choice of Word64 makes sense without further explanation. The perhaps surprising part is the use of `Maybe`. The reason for this is that in the case of a chunked request body, there&#39;s no way to know the size of the request body from the headers alone. So the logic for populating this field would go something like:</div>

<div style><ul style><li style>If content-length is supplied by the user, parse it and populate the field with Just content-length.</li><li style>If the request is chunked, populate with Nothing.</li><li style>Otherwise, there is a zero-sized request body, and populate with Just 0.</li>

</ul><div style>One other idea would be to create a special datatype such as `data RequestBodyLength = ChunkedBody | KnownLength Word64`, but I don&#39;t believe it really adds much above the `Maybe Word64`.</div><div style>

<br></div><div style>Any thoughts on this proposal?</div><div style><br></div><div style>Note: This is related to Yesod issue: <a href="https://github.com/yesodweb/yesod/issues/468">https://github.com/yesodweb/yesod/issues/468</a></div>

</div></div>