Perl-Sensitive Sunglasses | |
PerlMonks |
Adding a 'Host' request header leads to unexpected LWP::UserAgent behaviourby tomgracey (Scribe) |
on Jun 16, 2016 at 15:36 UTC ( [id://1165867]=perlquestion: print w/replies, xml ) | Need Help?? |
tomgracey has asked for the wisdom of the Perl Monks concerning the following question: Hello all. Consider the following code:
The 'Host' header is there so the destination server knows which website I'm after on that ip and port. Surely this header should not have any effect on where LWP sends the request? However, I'm getting this: Response: 500 Can't connect to www.example.com:82It seems to be taking the Host header, adding the port and going to look for that, instead of looking for what is passed to it in $target. Very odd! If I remove the line that adds the default_header, then: Response: 200 OKStumped! Can anyone shed any light?
Back to
Seekers of Perl Wisdom
|
|