[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

rodmc

2/28/2008 12:45:00 PM

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

5 Answers

Jarek Zgoda

2/28/2008 12:58:00 PM

0

rodmc napisa3(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.

--
Jarek Zgoda
Skype: jzgoda | GTalk: zgoda@jabber.aster.pl | voice: +48228430101

"We read Knuth so you don't have to." (Tim Peters)

Steve Holden

2/28/2008 1:44:00 PM

0

Jarek Zgoda wrote:
> rodmc napisa3(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.
>
It's unlikely that any other type of URL would result in the browser
sending a "Referer:" header.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.hold...

Jarek Zgoda

2/28/2008 1:51:00 PM

0

Steve Holden napisa3(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.
>>
> 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.

--
Jarek Zgoda
Skype: jzgoda | GTalk: zgoda@jabber.aster.pl | voice: +48228430101

"We read Knuth so you don't have to." (Tim Peters)

Bryan Olson

2/28/2008 2:33:00 PM

0

rodmc wrote:
> 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.

Bryan Olson

2/28/2008 2:45:00 PM

0

rodmc wrote:
> 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.


--
--Bryan