murky_cat has asked for the wisdom of the Perl Monks concerning the following question:

What should I do to force LPW using HTTP/1.0 when installing modules from CPAN?

There is variable $ENV{PERL_LWP_USE_HTTP_10} but where I need to set it like

BEGIN { $ENV{PERL_LWP_USE_HTTP_10} = 1; }

I need to use HTTP/1.0 because I want it to work through NTLMAPS, which won't work fine with HTTP/1.1.

Thank you for advices!

Replies are listed 'Best First'.
Re: Strawberry CPAN via HTTP/1.0
by Eliya (Vicar) on Mar 17, 2011 at 15:21 UTC

    How about setting it in the command shell before you run the cpan shell:

    set PERL_LWP_USE_HTTP_10=1
      Has no effect - NTLMAPS log said:
      17.03.2011 18:44:48 GET http://cpan.mirror.iphh.net/authors/01mailrc. +txt.gz HTTP/1.1 (from 127.0.0.1:2945)

        What exactly have you done?  A quick check of the source makes me think this should be pretty straight forward.  LPW::UserAgent has this piece of code

        if ($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'); }; }

        which loads the respective module if the environment variable is set/true.  This is the only occurrence of the variable in the entire LWP distribution, and the CPAN module/shell doesn't seem to touch the variable either...

        From that, I'd figure you've either somehow set it incorrectly, or LWP::UserAgent isn't being used to make the connection.

        Anyhow, for debugging purposes (or as a last resort), you could simply modify that line to read (you find it near the top of UserAgent.pm)

        if (1 or $ENV{PERL_LWP_USE_HTTP_10}) { # always true ...

        and see what happens then...

        cpan> o debug all