I am trying to use get (or head) on an HTTPS address. It's working fine as long as I don't have a proxy configured on my machine (proxy environment variable https_proxy). I have tried with LWP::simple and LWP::userAgent. Following environment variable exists on my machine:
http_proxy=http://www-proxy.companyDomain:8080/ https_proxy=http://www-proxy.companyDomain:8080/ no_proxy=localhost, 127.0.0.1, .companyDomain
If I am testing towards HTTP it works fine.
If I am testing towards HTTP and remove the environment variable "no_proxy", it doesn't work (as expected). To me, thats a kind of proof that both "http_proxy" and "no_proxy" env variables are (indirectly) used by my script.
If I test towards HTTPS and remove the "https_proxy" env variable, then it works fine (no matter if the "no_proxy" env variable is there or not). To me thats a kind of proof that the env vaiable "no_proxy" isn't used when I am testing towards an HTTPS address.

Finally, I did another test. I was using wget directly from the linux shell (towards the same HTTPS-address), and it was working. Thats why I think I have noticed a limitation or bug in LWP (OR I might be using it the wrong way).
Note that I don't do anything read the environment variables to the script (from the machine). I thought I had to, but it seems to be done automatically (well, except for "no_proxy" when using https. I have tried different alternatives to import the environment variables to the script, but with no success.
I am using perl5.8.9 on a linux.

Here is how my script looks like:
use strict; use warnings; use LWP::UserAgent; my $address = "https://companyDomain/subpage"; # Start useragent and get the webpage my $ua = new LWP::UserAgent; my $head_request = new HTTP::Request GET => $address; my $head_response = $ua->request( $head_request ); # Evaluate result if ($head_response->is_success){ print " is valid\n"; } else { print ": is invalid\n"; }
I mentioned I have tried to use a number of ways to be able to solve this(one at a time), for example:
$ENV{HTTPS_PROXY} = ''; $ua->proxy(['http', 'https'] => ''); $ua->no_proxy(".companyDomain"); $ua->env_proxy('no_proxy=.companyDomain');
Anyone who has some thoughts/ideas/suggestions? Solution or workaround? If not with LWP, so Perhaps a solution with another module.

In reply to LWP https problem with no_proxy by dian

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.