|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.