From: Allister L. S. <all...@gm...> - 2008-09-10 07:07:03
|
Hi Kim, On Wed, Sep 10, 2008 at 8:12 AM, Kim Gräsman <kim...@gm...> wrote: > Cool, thanks! You're welcome :-) > I had trouble with custom headers, though, and it looks like they're > still hard to pull through? > > I'm thinking about maybe base64-encoding all of self.headers and > putting it into an env var as-is, and then decoding it on the CGI > side. That should do the trick... If we look deep at the code (see $PYTHON_HOME/Lib/rfc822.py), self.headers is simply a list. One can simply concatenate the elements of a list (with a really unique separator) and add it into os.environ. Something like this in http_test_server.py: all_headers = ',--aUniqueSeparator--,'.join(self.headers) os.environ['HTTP_ALL_HEADERS'] = all_headers and in the CGI script, we can easily recover it: list_of_all_headers = os.environ.get('HTTP_ALL_HEADERS','').split(',--aUniqueSeparator--,') There you have it. I'll commit it after work -- or you could commit it yourself ;-) Cheers, Allister |