in reply to Re^2: Setting HTTP Protocol Version
in thread Setting HTTP Protocol Version

I said copy LWP::Protocol::http10. You then modify it as you see fit (see ->protocol), register as the implementor, and you're finished.

Replies are listed 'Best First'.
Re^4: Setting HTTP Protocol Version
by wagnerc (Sexton) on Aug 27, 2009 at 13:00 UTC
    That makes a little more sense. But what protocol() method are u referring to? U need to increase ur verbosity level. Trying using -vv.
      What the Anonymous Monk is referring to is doing this in your code:
      use LWP; require LWP::Protocol::http10; LWP::Protocol::implementor('http', 'LWP::Protocol::http10'); my $ua = LWP::UserAgent->new(); $ua->get('http://server.local/foo');
      This code would connect to server.local using HTTP/1.0 instead of HTTP/1.1.

      But instead of using LWP::Protocol::http10 as your Protocol implementor, copy LWP::Protocol::http10 code to a new module, perhaps call it MyLWP::Protocol::brokenhttp and change the code in there to use your custom HTTP version and GET format

      Update: This was slightly covered already, but something like: find the LWP/Protocol/http10.pm file in your perl library, copy it to your local lib path as MyLWP/Protocol/brokenhttp.pm then edit it, then use that name as the last option to the implementor function.

        Thanks for clarifying that. I slowly came to the conclusion that the implementor function was what I needed for 1.0 (as I previously posted). I blame the documentation.

        However I still have to blame the authors for not giving us any way of controling the URI. Having to hack internals is not really the right way to do things. Not every web service out there is RFC compliant and we should have a standardized way of dealing with them.

      in LWP::Protocol::http10, why aren't you looking?
        LWP::Protocol::http10 has no protocol() method. Nor does LWP::Protocol have one. Don't me smarmy. I combed the source code of all those modules before I even posted.

        Implementor is poorly documented and LWP::Protocol::http10 is not documented at all. So don't act like "I should just know."