Just a caveat, since your code makes me think you misunderstand just a wee bit. The implementor matters at the time you make the request, not when you create the user agent object. So in your example, if you add the line
$ua->request($req);at the end there, I think you'll find that it makes an HTTP/1.1 request, not HTTP/1.0 like your code leads me to believe you might be thinking (your code suggests to me that you think you have now an 'HTTP/1.0 user agent' ($ua) and an 'HTTP/1.1 user agent' ($ua2) and you can just alternate UAs to alternate which protocol to use). See the code I suggested above in my update.
At least, this is the behavior I found when I tested with my version, which may be different from yours.
HTH
In reply to Re: Re: Re: LWP::UserAgent Wrongly Uses HTTP/1.1
by edan
in thread LWP::UserAgent Wrongly Uses HTTP/1.1
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |