"Grue" <[EMAIL PROTECTED]> writes:

>     ok, i've searched high and low for an explanation for this, but to no
> avail.  i apologize if it's common knowledge.
> 
>     i'm writing a test robot that wanders around my site.  i'm explicitly
> setting the 'referer' tag this way:
> 
>     $request = HTTP::Request->new(GET => $someurl);
>     $request->push_header($referer => $lasturl);
> 
>     ...making sure that $lasturl was the url is sent to HTTP::Request the
> last time through the loop.
> 
>     when i process the request via LWP::UserAgent, the program sometimes
> dies with this error:
> 
>     "Unexpected field value $lasturl at .../Message.pm line 189"
> 
>     (it actually prints out the contents of $lasturl, not "$lasturl".)
> 
>     this appears to be the last line in the AUTOLOAD sub of HTTP::Message.
> 
>     the message only comes up in certain circumstances:  when $someurl is a
> URL that came from an 'img' tag, when $someurl points to a directory
> containing an index.cgi file, and so on.
> 
>     i've tried setting the referer in other ways:
> 
>     $request->referer($lasturl);
> 
>     this gives the same results.
> 
>     i'm running libwww-perl-5.48, perl 5.005_03 on a redhat 6.1 i386-linux
> box.
> 
>     i really appreciate any help anyone can give me here.  thanks!

My guess is that sometimes your $lasturl is a plain string and
sometimes it is a URI object reference.  Try to make sure you always
pass a string:

   $request->push_header($referer => "$lasturl");

The ""Unexpected field value" message is generated by
&HTTP::Headers::_header.  Perhaps it would be better if it just
stringified the value it got instead of croaking.

Regards,
Gisle

Reply via email to