URLlib2?

R

rodmc

Hi,

Probably a silly question but I am writing a CGI script which need to
check the referring URL, can anyone provide any pointers? I have
looked at URLLib2 and a couple of other libraries, but am slightly
confused.

Thanks in advance,
rod
 
J

Jarek Zgoda

rodmc napisa³(a):
Probably a silly question but I am writing a CGI script which need to
check the referring URL, can anyone provide any pointers? I have
looked at URLLib2 and a couple of other libraries, but am slightly
confused.

Using httplib you can issue HEAD request to check if it does not return
404 response, but this works only with HTTP/HTTPS urls.
 
S

Steve Holden

Jarek said:
rodmc napisa³(a):


Using httplib you can issue HEAD request to check if it does not return
404 response, but this works only with HTTP/HTTPS urls.
It's unlikely that any other type of URL would result in the browser
sending a "Referer:" header.

regards
Steve
 
J

Jarek Zgoda

Steve Holden napisa³(a):
It's unlikely that any other type of URL would result in the browser
sending a "Referer:" header.

Right, perfectly valid assumption. ;)

I am bit too defensive today.
 
B

Bryan Olson

rodmc said:
Probably a silly question but I am writing a CGI script which need to
check the referring URL, can anyone provide any pointers? I have
looked at URLLib2 and a couple of other libraries, but am slightly
confused.

When you say, "check the referring URL," what are checking about
it? Do you just want to know from where your users came? C.l.p is
one of Usenet's more helpful groups, but you have to clear and
exact, or we're likely to correctly answer the wrong question.


One reason that web sites check referring URL's is to try to
ensure that client went through the site's intended path. The
site might want to make sure users saw the terms-and-condition,
or stop other sites from "deep linking", or prevent so-called
"bandwidth theft". In these cases, checking the referrer is a
weak solution. There is a much better method based on cookies,
which all the popular browsers now support.
 
B

Bryan Olson

rodmc said:
Probably a silly question but I am writing a CGI script which need to
check the referring URL, can anyone provide any pointers? I have
looked at URLLib2 and a couple of other libraries, but am slightly
confused.

When you say, "check the referring URL," what are checking about
it? Do you just want to know from where your users came? C.l.p is
one of Usenet's more helpful groups, but you have to clear and
exact, or we're likely to correctly answer the wrong question.

There are many plausible checks one might apply to the referring
URL. Some are trivial, some subtle.

One reason that web servers check referring URL's is to try to
ensure that clients go through the intended path. Perhaps the
site simply wants to make sure users see teh terms-and-conditions,
but more commonly it wants to stop other sites from "deep
linking", or thwart so-called "bandwidth theft". In these cases,
checking the referrer is a weak solution; the better method is
based on cookies.
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top