Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > URLlib2?

Reply
Thread Tools

URLlib2?

 
 
rodmc
Guest
Posts: n/a
 
      02-28-2008
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

 
Reply With Quote
 
 
 
 
Jarek Zgoda
Guest
Posts: n/a
 
      02-28-2008
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.

--
Jarek Zgoda
Skype: jzgoda | GTalk: http://www.velocityreviews.com/forums/(E-Mail Removed) | voice: +48228430101

"We read Knuth so you don't have to." (Tim Peters)
 
Reply With Quote
 
 
 
 
Steve Holden
Guest
Posts: n/a
 
      02-28-2008
Jarek Zgoda wrote:
> 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.
>

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.holdenweb.com/

 
Reply With Quote
 
Jarek Zgoda
Guest
Posts: n/a
 
      02-28-2008
Steve Holden 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.
>>

> 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: (E-Mail Removed) | voice: +48228430101

"We read Knuth so you don't have to." (Tim Peters)
 
Reply With Quote
 
Bryan Olson
Guest
Posts: n/a
 
      02-28-2008
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.

 
Reply With Quote
 
Bryan Olson
Guest
Posts: n/a
 
      02-28-2008
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments