
On Mon, Jan 23, 2012 at 10:43 PM, Michael Snoyman
On Tue, Jan 24, 2012 at 8:37 AM, Myles C. Maxfield
wrote: I have attached a patch to add a redirect chain to the Response datatype. Comments on this patch are very welcome.
I thought that this isn't necessary since a client wanting to track all the redirects could just handle them manually by setting the redirect count to 0.
It seems like a lot of work to re-implement the redirection-following code, just to know which URL the bytes are coming from. I feel that adding this field makes the library easier to use, but it's your call.
I was originally going to include the entire Request object in the redirection chain, but Request objects are parameterized with a type 'm', so including a 'Request m' field would force the Response type to be parameterized as well. I felt that would be too large a change, so I made the type of the redirection chain W.Ascii.
Perhaps its worth using the 'forall' keyword to get rid of the pesky 'm' type parameter for Requests?
data RequestBody = RequestBodyLBS L.ByteString | RequestBodyBS S.ByteString | RequestBodyBuilder Int64 Blaze.Builder | forall m. RequestBodySource Int64 (C.Source m Blaze.Builder) | forall m. RequestBodySourceChunked (C.Source m Blaze.Builder)
There'd be no way to run the request body then (try compiling the code after that change).
Yeah, I never actually tried this change to see if it works. I'll try it tonight after work.
Michael
Thanks, Myles