How to get CGI request-URL

  • Thread starter Hallvard B Furuseth
  • Start date
H

Hallvard B Furuseth

How can I get the URL the user typed (except the part after '?') with
the cgi module?

I expect the 'Host:' HTTP header + os.environ['SCRIPT_NAME'] would do
it, but I don't see how to find the Host header. The www server has
several names, so I can't just use the default host name.
 
P

Peter Hansen

Hallvard said:
How can I get the URL the user typed (except the part after '?') with
the cgi module?

I expect the 'Host:' HTTP header + os.environ['SCRIPT_NAME'] would do
it, but I don't see how to find the Host header. The www server has
several names, so I can't just use the default host name.

This might help: http://hoohoo.ncsa.uiuc.edu/cgi/env.html

Found via Google....
 
G

Gilles Lenfant

Hallvard B Furuseth said:
How can I get the URL the user typed (except the part after '?') with
the cgi module?

I expect the 'Host:' HTTP header + os.environ['SCRIPT_NAME'] would do
it, but I don't see how to find the Host header. The www server has
several names, so I can't just use the default host name.

Don't remember but...

There's a test() function in the cgi module that shows the special data
available from a CGI script.

--Gilles
 
I

Irmen de Jong

Hallvard said:
Thanks for the answers.

Glad to be of assistance, but you didn't tell us what the
actual solution to your problem was... It is always a good idea
to do so because others that have the same problem, and
reading the thread, can immediately benefit :)

--Irmen
 
H

Hallvard B Furuseth

Irmen said:
Glad to be of assistance, but you didn't tell us what the
actual solution to your problem was... It is always a good idea
to do so because others that have the same problem, and
reading the thread, can immediately benefit :)

Good point. I'll come back when I'm sure my solution actually works...
I need to get someone to intall the program first.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top