From: K. G. <kim...@gm...> - 2008-09-09 11:29:45
|
Hi Dean, On Tue, Sep 9, 2008 at 11:22, Dean Michael Berris <mik...@gm...> wrote: >> So, as far as I can see there's no reliable way to dump all request >> headers to the response from a CGI script, via the Python server. The >> ones that make it through are listed in the run_cgi method in Python's >> CGIHTTPServer.py. Content-Length and Content-Type are among them, so I >> thought I had it working for a while :-/ > > Is there no way to define which headers (or if all headers) should be preserved? Not as far as I can tell... I think maybe this problem is part of the CGI concept as well; since it uses environment vars to pass on selected headers, there's a risk that custom headers overwrite env vars that the shell depends upon. Unless you jump through hoops to escape them, etc, or encode all headers into one long string, somehow. But then it's no longer CGI per se. > That should be alright... We may find a better way to go about things > if we write our own HTTPServer extension which does what we want > instead of relying on the CGIHTTPServer that Python defines. > > I don't have enough Python kung fu to be able to pull it off yet > though so if you find other ways, I'm all ears. ;-) Me neither, I'm just guessing my way ahead :) We could potentially derive from one of the requesthandlers and implement our own, but then we'd have to figure out a good way to get all the request data from the web server to the handler script, essentially reinventing CGI. Unless we want to do it all in one mega-script, in-process. Oh well... - Kim |