http://qs321.pair.com?node_id=1045356

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

I'm trying to do a simple request to an https URL with WWW::Mechanize.

I've got Crypt::SSleay, I know the site is up and the URL is correct, regular browsers can connect to it, but all I get is a long wait and the message "can't connect to website.com:443". What should I try?

Edit: WWW::Mechanize can connect to other https sites just fine, for the record. Not sure what that means but it's another clue.

Replies are listed 'Best First'.
Re: WWW::Mechanize and https/port 443
by hdb (Monsignor) on Jul 19, 2013 at 13:40 UTC

    From WWW::Mechanize

    noproxy => [0|1]
    Turn off the automatic call to the LWP::UserAgent env_proxy function.
    This needs to be explicitly turned off if you're using Crypt::SSLeay to access a https site via a proxy server. Note: you still need to set your HTTPS_PROXY environment variable as appropriate.
      Thanks but surely that only applies if there's a proxy server involved, and there isn't, at least not explicitly. I suppose there could be something going on with the ISP. I'll try it.
        Tried that, no change I'm afraid.
Re: WWW::Mechanize and https/port 443
by daxim (Curate) on Jul 19, 2013 at 13:38 UTC
      That's logical, but I have done that and it hasn't changed anything.
Re: WWW::Mechanize and https/port 443
by Kanji (Parson) on Jul 21, 2013 at 04:04 UTC

    LWP::UserAgent defaulted to verifying SSL connections with 6.00, so if you can connect to one site and not another, it's likely a certificate issue.

    If you're sure that the site can be trusted despite a bad certificate (or you just don't care), you can override this behaviour in ssl_opts.

    my $mech = WWW::Mechanize->new( ssl_opts => { verify_hostname => 0 }, );