Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: HTTPS returning 400 from Linux but 200 OK from Windows

by Random_Walk (Prior)
on Feb 13, 2017 at 18:07 UTC ( [id://1181911]=note: print w/replies, xml ) Need Help??


in reply to Re: HTTPS returning 400 from Linux but 200 OK from Windows
in thread HTTPS returning 400 from Linux but 200 OK from Windows

I have LWP::ConsoleLogger installed after much struggle to get it built within the restrictions of the client site. Sadly it has brought me no new enlightenment. My only though now is that Perl does not like my https_proxy being an http url.

# curl https://google.com/ <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset +=utf-8"> <TITLE>302 Moved</TITLE></HEAD><BODY> <H1>302 Moved</H1> The document has moved <A HREF="https://www.google.se/?gfe_rd=cr&amp;ei=IvWhWPTvI4b67gSTn7ygA +g">here</A>. </BODY></HTML> # perl test.pl GET https://google.com/ .-----------------+--------------------. | Request Header | Value | +-----------------+--------------------+ | Accept-Encoding | gzip | | User-Agent | WWW-Mechanize/1.83 | '-----------------+--------------------' ==> 500 Can't connect to google.com:443 .-----------------+-------------------------------. | Response Header | Value | +-----------------+-------------------------------+ | Client-Date | Mon, 13 Feb 2017 18:04:23 GMT | | Client-Warning | Internal response | | Content-Type | text/plain | '-----------------+-------------------------------' .--------------------------------------------------------------------- +--------------------------------------------------------------------- +---. | Content + + | +--------------------------------------------------------------------- +--------------------------------------------------------------------- +---+ | Can't connect to google.com:443 + + | | + + | | Name or service not known at /usr/lib/perl5/site_perl/5.18.2/LWP/Pro +tocol/http.pm line 47, <DATA> line 1. + | '--------------------------------------------------------------------- +--------------------------------------------------------------------- +---' .--------------------------------------------------------------------- +--------------------------------------------------------------------- +---. | Text + + | +--------------------------------------------------------------------- +--------------------------------------------------------------------- +---+ | Can't connect to google.com:443 + + | | + + | | Name or service not known at /usr/lib/perl5/site_perl/5.18.2/LWP/Pro +tocol/http.pm line 47, <DATA> line 1. + | '--------------------------------------------------------------------- +--------------------------------------------------------------------- +---' Error GETing https://google.com/: Can't connect to google.com:443 at t +est.pl line 22.
Thanks for taking the time. I have at least learned a bit more about the web tools available in Perl :)

Cheers,
R.

Pereant, qui ante nos nostra dixerunt!

Replies are listed 'Best First'.
Re^3: HTTPS returning 400 from Linux but 200 OK from Windows
by Corion (Patriarch) on Feb 13, 2017 at 18:32 UTC

    Unfortunately, LWP::ConsoleLogger doesn't seem to be talkative about when it is trying to connect to a proxy.

    You can try to find which proxy LWP will try to use:

    #!perl -w use strict; use LWP::ConsoleLogger::Easy 'debug_ua'; use Data::Dumper; use LWP::UserAgent; my $ua=LWP::UserAgent->new(); warn Dumper $ua->proxy('https'); my $logger=debug_ua($ua,5); print Dumper \%ENV; $ua->env_proxy; warn Dumper $ua->proxy('https'); $ua->get('https://google.com')

    This should show you that your proxy URL is in %ENV and also picked up from there in the $ua.

    Maybe your proxy does not let Perl through? Have you tried masquerading your Perl script as curl (because that seems to work?)?:

    $ua->default_headers->header('User-Agent' => 'curl/7.10.x (i386-redhat +-linux-gnu) libcurl/7.10.x OpenSSL/0.9.7a ipv6 zlib/1.1.4');

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1181911]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-23 06:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found