Hmm, by default LWP::UserAgent should be sending a HTTP/1.1 request. LWP::UserAgent contains
LWP::Protocol::http10 sends HTTP/1.0, where as LWP::Protocol::http sends HTTP/1.1. Net::HTTP is what's used underneath the hood, and describes this and more (see http_version, peer_http_version). Here's a little demoif ($ENV{PERL_LWP_USE_HTTP_10}) { require LWP::Protocol::http10; LWP::Protocol::implementor('http', 'LWP::Protocol::http10'); eval { require LWP::Protocol::https10; LWP::Protocol::implementor('https', 'LWP::Protocol::https10'); }; }
use strict; use warnings; use LWP; use LWP::Debug '+'; use Data::Dumper; my $ua = LWP::UserAgent->new(); $ua->get(shift || 'http://localhost'); # because LWP I<use>s it at runtime use LWP::Protocol::http; package LWP::Protocol::http::Socket; sub format_request { my $self = shift; my $ret = $self->SUPER::format_request(@_); LWP::Debug::trace($ret); return $ret; } __END__ LWP::UserAgent::new: () LWP::UserAgent::request: () LWP::UserAgent::send_request: GET http://localhost LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::http::Socket::format_request: GET / HTTP/1.1 TE: deflate,gzip;q=0.3 Connection: TE, close Host: localhost User-Agent: libwww-perl/5.75 LWP::Protocol::collect: read 640 bytes LWP::Protocol::collect: read 854 bytes LWP::UserAgent::request: Simple response: OK
In reply to Re: Using HTTP/1.1 instead of 1.0 (was: Re: Mechanize and "Not implemented")
by PodMaster
in thread Mechanize and "Not implemented"
by Roy Johnson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |