[web-devel] [Yesod] WAI enhancement: request body size
Felipe Almeida Lessa
felipe.lessa at gmail.com
Tue Feb 12 18:22:06 CET 2013
+1 for the idea.
+2 for using a custom data type: it's *much* easier to read.
On Tue, Feb 12, 2013 at 1:06 PM, Michael Snoyman <michael at snoyman.com> wrote:
> I'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:
> requestBodyLength :: Maybe Word64
> 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'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:
> If content-length is supplied by the user, parse it and populate the field
> with Just content-length.
> If the request is chunked, populate with Nothing.
> Otherwise, there is a zero-sized request body, and populate with Just 0.
> One other idea would be to create a special datatype such as `data
> RequestBodyLength = ChunkedBody | KnownLength Word64`, but I don't believe
> it really adds much above the `Maybe Word64`.
> Any thoughts on this proposal?
> Note: This is related to Yesod issue:
> You received this message because you are subscribed to the Google Groups
> "Yesod Web Framework" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to yesodweb+unsubscribe at googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
More information about the web-devel