Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the WWW-Mechanize CPAN distribution.

Report information
The Basics
Id: 2816
Status: resolved
Priority: 0/
Queue: WWW-Mechanize

People
Owner: Nobody in particular
Requestors: stuart [...] terminus.co.uk
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Set Referrer header
The most common browsers use the Referrer header, and we are trying to mimic them. Also, some sites [mistakenly] rely on it. It should be noted however that some people don't like the Referrer header, and implementation varies: some browsers don't use it, some only use it within the same site/domain, others easily allow their users to fake it. So perhaps its use should be made optional. So, when we are using any of the link following or form submitting methods we should set the Referrer header. However, methods such as get() should not set it when they are called directly. This may cause a slight complication during implementation (as the request object (that we need to set the header on) is created within get(), and get() is called from follow() and follow_link()).
[guest - Tue Jun 17 11:29:13 2003]: Show quoted text
> The most common browsers use the Referrer header
Sure, Microsoft Internet Explorer, Netscape Navigator and Mozilla do and that's many browsers. Show quoted text
> and we are trying to mimic them.
That's why I'm using WWW::Mechanize, to mimic browsers. Show quoted text
> Also, some sites [mistakenly] rely on it.
I'm with you: Death to the Referer header. It's just shit. Show quoted text
> It should be > noted however that some people don't like the Referrer header
I don't like the Referer header (I hate it) but I must cope with it. Show quoted text
> and > implementation varies: some browsers don't use it
Sure, my home made browser don't use it. But I'm using WWW::Mechanize to mimic IE/Mozilla Show quoted text
> some only use it > within the same site/domain, others easily allow their users to > fake it. So perhaps its use should be made optional.
I'm using WWW::Mechanize to mimic IE/Mozilla. But an option to break IE/Mozilla behavior is OK as long that's not a default. Show quoted text
> So, when we are using any of the link following or form submitting > methods we should set the Referrer header. > > However, methods such as get() should not set it when they are called > directly. This may cause a slight complication during > implementation (as the request object (that we need to set the > header on) is created within get(), and get() is called from > follow() and follow_link()).
But I need It since I sometimes do: my $res = $agent->get('http://www.host.com/'); if ($res->is_success) { $res = $agent->get('http://www.host.com/register/'); and I need to keep the Referer header. If you need to clear the Referer you should create another session by creating another WWW::Mechanize agent.
From: stuart [...] terminus.co.uk
This appears to be implemented as of WWW::Mechanize 0.45. The Referer header is set inside request() to be the last URI visited. So it will be set for all requests, contrary to my thoughts above, but I can understand people wanting it to work both ways and this will work for me.
I'm glad it works out for you. Let me know if you have any other problems/requests.