I waded through some of the LWP::UserAgent code to try and find your answer. I think I found it. Basically, I don't think you can get LWP to do this. The reason (from what I think I understood) is as follows.

LWP::UserAgent seems to only honor the method (i.e. http, https) and uri of the HTTP::Request that you give it. The protocol() method that you are trying to set on the Request (which is actually inherited from HTTP::Message) seems to only be used for setting the protocol of the peer (i.e. web-server) for the HTTP::Response that you get back.

What determines the protocol of the request (which is what you're interested in) is the http_version of the Net::HTTP::Methods object, which the LWP::Protocol::http::Socket (which is how the request is actually sent) inherits from. The crucial bit of code is found in LWP/Protocol/http.pm, in the _new_socket() method, where the socket is created. The call to new() would need to have an argument HTTPVersion => '1.0', which Net::HTTP->new() (Net::HTTP is a sub-class of IO::Socket::INET, FYI) would use to set the request HTTP version to 1.0.

Whew. Hope that made some sense.

--
3dan


In reply to Re: LWP::UserAgent Wrongly Uses HTTP/1.1 by edan
in thread LWP::UserAgent Wrongly Uses HTTP/1.1 by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.