[MERGE] http+pycurl supports redirects

Michael Ellerman michael at ellerman.id.au
Wed Jul 19 05:57:21 BST 2006

On 7/19/06, John Arbash Meinel <john at arbash-meinel.com> wrote:
> Michael Ellerman wrote:
> > I don't understand what "body_is_header" is for, we only ever want the
> > headers associated with the final response don't we?
> I just made it optional, in case we found something different.

OK. I'm more of a don't-add-it-until-it's-used kinda guy, but that's
just me. I still don't grok why it's called "body_is_header" though?

> > I also wonder if it should be a little stricter, and look for
> > "\r\n\r\nHTTP" as the sign that a new set of headers is starting? I
> > also think it should be a loop so we can handle a double/triple
> > redirect.
> Actually, it is recursive. So it will handle as many as it needs to.

Oh right, duh. That limits it to some finite number of redirects ..
but I guess we'll live with that ;)

> I don't know if we want to be 100% strict about requiring '\r\n'. I
> would be okay with '\n' or '\r\n'.
> We could be more strict and require response.startswith('HTTP'). By the
> time we get there, the '\r\n' has already been consumed by the rfc822
> parser.

Yeah, not sure. It'd be nice to be somewhat tolerant of a stray blank
line in the headers, even if that is illegal it might happen. Perhaps
just require it start with 'HTTP '.


More information about the bazaar mailing list