[Web-SIG] [client side] RFC 2616 HTTP header parsing, Digest auth,
John J Lee
jjl at pobox.com
Wed Nov 5 12:10:57 EST 2003
First, Greg (Stein): do you intend to do the necessary work (whatever that
is -- ?) to get httpx into Python 2.4?
There seem to be a whole bunch of functions around which all parse HTTP
foo=bar; spam="e g\"g;s,", another=header missing=semicolon, lonetoken; missingvalue=
Concatenated header values are separated by commas. Optional semicolons
separate key/value pairs. Values are optionally quoted. Quoted values
may contain commas, semicolons and (\-quoted) quotes. Values may be empty
(foo=) or missing (foo). Not sure if this is defined formally somewhere
in RFC 2616. I may have the details wrong.
Something like this is needed by both digest auth and cookie handling.
urllib2 defines (broken) functions to do this, and I think Anthony, Greg
S. and me all have functions to do this job. I don't see why they can't
all be merged.
For cookies, a restricted version of the RFC 2616 format will do (I don't
need to worry about missing semicolons). [I also need a weird function to
handle Netscape cookies, but that's another story.]
Do either of you have a function that you think will do most of this?
I have a rather liberal, not very beautiful, implementation that uses
regexps, ported from Perl.
I don't care much what gets used, as long as we don't end up with four or
five separate functions!
More information about the Web-SIG