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

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?
  • Comment on Re: Re: Re: LWP::UserAgent Wrongly Uses HTTP/1.1

Replies are listed 'Best First'.
Re: Re: Re: Re: LWP::UserAgent Wrongly Uses HTTP/1.1
by edan (Curate) on Nov 20, 2003 at 14:10 UTC

    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