in reply to Re: LWP::UserAgent Wrongly Uses HTTP/1.1
in thread LWP::UserAgent Wrongly Uses HTTP/1.1

Try setting it in your actual environment. The module is loaded at compile time (assuming you're using use), so setting the ENV at runtime won't help. Or, put that line in a BEGIN block before you use LWP::UserAgent;

HTH

--
3dan

  • Comment on Re: Re: LWP::UserAgent Wrongly Uses HTTP/1.1

Replies are listed 'Best First'.
Re: Re: Re: LWP::UserAgent Wrongly Uses HTTP/1.1
by Anonymous Monk on Nov 20, 2003 at 14:03 UTC
    It does work if I set it my shell environment before calling the script, but this brings up another point: my script needs to send some HTTP/1.0 and some HTTP/1.1 requests. Is it possible to do both in one script, then?

      Mmm. dunno. I've already spent far too much time researching your problem, when I have real work to do! :). I would guess no, it's not possible for the same script to, since it looks like http10.pm will only make HTTP/1.0 requests. Perhaps set/unset the ENV variable and spawn off scripts that make the requests?. Good luck!

      Update

      Perhaps AM's suggestion is a direction to try... here's some sort-of tested code to play with.

      use LWP::UserAgent; require LWP::Protocol::http10; my $url = "http://localhost/"; my $ua = LWP::UserAgent->new(); my $req = HTTP::Request->new(GET => $url); # make HTTP/1.1 request LWP::Protocol::implementor('http', 'LWP::Protocol::http'); $ua->request($req); # make HTTP/1.0 request LWP::Protocol::implementor('http', 'LWP::Protocol::http10'); $ua->request($req);
      --
      3dan