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

I am posting request to an HTTPS protected page using LWP::UserAgent. I have tested the script at home, where I can access the site directly and at work where I use a proxy server. Everything works OK at home but as soon as the proxy is used, the script breaks. I believe that this indicates that problem lies with the combination of proxy and HTTPS since all other combinations work OK.

I am currently using libwww-perl-5.64 but I have downloaded the latest version (libwww-perl-5.76) after reading a bug report that described the issue with HTTPS and proxy servers. Does any monk know whether the bug has been fixed or whether there are workarounds?

For reference - I am using win32 and AS Perl 5.6.1.

  • Comment on Posting request to an HTTPS protected site through a proxy.

Replies are listed 'Best First'.
Re: Posting request to an HTTPS protected site through a proxy.
by leira (Monk) on Mar 01, 2004 at 16:50 UTC
    Ther "LWP::UserAgent Proxy Support " section of the Crypt::SSLeay POD might shed some light on why you're having trouble.

    According to that, LWP::UserAgent does a GET, but some proxies expect a CONNECT for HTTPS urls.

    Linda

      Thanks! Initial results look promising although I will need to re-try in the office. ++ to you!

      Update: The change worked!.

      For future reference, the code looks like this.

      # Create User Agent my $ua = LWP::UserAgent->new(timeout => 30, keep_alive => 10); # Use a proxy server if configured for normal HTTP $ua->proxy (['http'], $ProxyUrl) if $ProxyUrl; # Add Env var for Crypt::SSLeay $ENV{HTTPS_PROXY} = $ProxyUrl) if $ProxyUrl;