Skip Menu |

This queue is for tickets about the libwww-perl CPAN distribution.

Report information
The Basics
Id: 48461
Status: resolved
Priority: 0/
Queue: libwww-perl

People
Owner: Nobody in particular
Requestors: slushie [...] gmail.com
Cc:
AdminCc:

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



Subject: LWP::UserAgent::new overwrites default_headers' User-Agent string
Date: Wed, 5 Aug 2009 13:32:56 -0600
To: bug-libwww-perl [...] rt.cpan.org
From: Josh <slushie [...] gmail.com>
Whenever a new LWP::UserAgent object is created via new(), the agent() method is called on the new object. This method sets the User-Agent header via the default_headers object. Unfortunately, if the default_headers object passed to the constructor already has a User-Agent header, the agent() method will overwrite it. There is no test in the constructor to see if this header has already been set before overwriting it. The only workarounds to have the user agent object send the User-Agent header from default_headers are either to extract the default_headers' User-Agent string and pass it to the constructor via the 'agent' setting, or to set the object's default_headers via the method call rather than in the constructor. It seems the correct functionality would be to skip calling $self->agent() inside the constructor if default_headers already has a User-Agent set. Thank you for continued development of this very useful library.
Fixed in <http://github.com/gisle/libwww- perl/commit/17379dd4066ed4aeee84aad6ec63b15bd4e0f1f6>