473,396 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to get CGI request-URL

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.

--
Hallvard
Jul 18 '05 #1
5 6357
Hallvard B Furuseth wrote:

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....
Jul 18 '05 #2
"Hallvard B Furuseth" <h.b.furuseth(nospam)@usit.uio(nospam).no> a écrit
dans le message de news: HB**************@bombur.uio.no...
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.

--
Hallvard


Don't remember but...

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

--Gilles

Jul 18 '05 #3
Hallvard B Furuseth wrote:
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

Jul 18 '05 #4
Irmen de Jong wrote:
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.

--
Hallvard
Jul 18 '05 #5
Irmen de Jong wrote:
Glad to be of assistance, but you didn't tell us what the
actual solution to your problem was...


'https://' + os.environ['SERVER_NAME'] + os.environ['REQUEST_URI']

--
Hallvard
Jul 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Sam Sungshik Kong | last post by:
Hello! I use Python for ASP programming. I found something weird. Response.Write(Request("something")) It draws "None" when there's no value for something. Actually I expect "" instead of...
6
by: Christopher Brandsdal | last post by:
Hi! I get an error when I run my code Is there any other way to get te information from my form? Heres the error I get and the code beneath. Line 120 is market with ''''''''''''Line...
2
by: Harag | last post by:
Hi All Using: JScript IIS 5 I have a problem in the following code: // The next 4 lines display exactly what was typed in the text boxes. out("<br>Request.Form="+...
4
by: SP | last post by:
Hi I have a problem with a customer's XML being submitting to me in a non-well-format XML. They said that there are 18 other partners who has been able to tweak the XML to make it work. So I...
7
by: Shapiro | last post by:
I have a scenario where I log a resquest to a database table and update the request with a corresponding response including the response time. I am using an HttpModule to do this. My challenge...
4
by: whyyyy | last post by:
USING IIS 5.1, and Windows XP pro, the following form works on my system, and I can use as many form elements as I wish, as long as all form elements have the same name: "words", in this example....
4
by: Michael Kujawa | last post by:
I am using the following to create an SQL statement using the names and values from request.form. The loop goes through each item in request.form The issue comes in having an additional "and" at...
0
by: kaczmar2 | last post by:
Hello, I have an aspx page which is posting xml content to another asp.net page, but the request.length is always 0. I think there should be something there. below is the code for the...
7
by: =?Utf-8?B?QVRT?= | last post by:
HOWTO Make CStr for JavaScript on ASP w/ Request.Form and QueryString In ASP, Request.Form and Request.QueryString return objects that do not support "toString", or any JavaScript string...
4
by: MATTXtwo | last post by:
Hi guys I need an answer... Is't posibble an asp pages to have more querystring? DBS=Request("TarikhLahir") TL=Request("tlahir") Negara=Request("Country") Negeri=request("State")...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.