Hello Monks,
I feel like going mad.
I need a perl-script, doing a 'https-file-get' to a http proxy with proxy-authentication. So far so good:
#!/usr/local/bin/perl -w use LWP::UserAgent; use LWP::Debug qw(+); $ENV{HTTPS_PROXY} = 'http://xxx.xxx.xxx.xxx:8080'; $ENV{HTTPS_PROXY_USERNAME} = 'myUsername'; $ENV{HTTPS_PROXY_PASSWORD} = 'myPassword'; my $ua = LWP::UserAgent->new; my $req = HTTP::Request->new'GET',"https://url.name.de/"); my $res = $ua->request($req); print $res->content;
BUT:
LWP::UserAgent::new: () LWP::UserAgent::request: () LWP::UserAgent::send_request: GET https://freemail.web.de/ LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::UserAgent::request: Simple response: Internal Server Error
is the result. So it seems that the Crypt::SSLeay does not work like it's mentionend in perldoc Crypt::SSLeay. The proxy is not recognized by LWP.
For native Crypt::SSLeay proxy support of https requests, you need to set an environment variable HTTPS_PROXY to your proxy server & port, as in: # PROXY SUPPORT $ENV{HTTPS_PROXY} = 'http://proxy_hostname_or_ip:port'; $ENV{HTTPS_PROXY} = '127.0.0.1:8080'; Use of the HTTPS_PROXY environment variable in this way is similar to LWP::UserAgent->env_proxy() usage, but calling that method will likely override or break the Crypt::SSLeay support, so do not mix the two. Basic auth credentials to the proxy server can be provided this way: # PROXY_BASIC_AUTH $ENV{HTTPS_PROXY_USERNAME} = 'username'; $ENV{HTTPS_PROXY_PASSWORD} = 'password'; For an example of LWP scripting with Crypt::SSLeay native proxy support, please see the source of the ./lwp-ssl-test script in the Crypt::SSLeay distribution.
Also the lwp-ssl-test does not recognize the proxy. And I can't use the LWP Proxy Supportliek this:
my $ua = new LWP::UserAgent; $ua->proxy([qw( https http )], "$proxy_ip:$proxy_port");
... because my proxy needs a CONNECT which is not yet implemented in LWP.

Any help/hints are welcome.
Cheers
----------------------------------- --the good, the bad and the physi-- -----------------------------------

In reply to no Proxy with LWP and Crypt::SSLeay by physi

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.