Need the Request/URL running SimpleHTTPRequestHandler

Erno Kuusela erno-news at erno.iki.fi
Sat Oct 21 05:26:30 EDT 2000


>>>>> "Thomas" == Thomas Weholt <thomas at cintra.no> writes:

 | Hi,
 | I'm trying to extend SimpleHTTPRequestHandler ( I've subclassed it )
 | and I need to get hold of the url the user submitted, or the request.

self.path has a part of it. it is not necessarily possible to
find out the full url the user agent was trying to access
since in http 1.0 the "host" header was optional. but newer
user agents include a "host:" header in the request.

 |  If I could get any deeper, like getting it allready at the
 | "protocoll"-level, like seeing what command the browser sent, like GET
 | etc. that would be nice too.

look at self.raw_requestline and self.headers (mimetools & rfc822
module docs explain what you can do with this - self.headers.headers
has a simple list)

  -- erno



More information about the Python-list mailing list