Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Access to https page.

by Toomy (Initiate)
on Feb 24, 2011 at 01:51 UTC ( #889891=perlquestion: print w/replies, xml ) Need Help??
Toomy has asked for the wisdom of the Perl Monks concerning the following question:

I got "500 proxy connect failed: PROXY ERROR HEADER, could be non-SSL URL" message when I ran my code. Could someone please help me? I am using Perl version 5.10. Here is the code:
1. #!/usr/bin/perl 2. use LWP::UserAgent; 3. use HTTP::Request::Common; 4. use Crypt::SSLeay; 5. 6. $url = ""; 8. my $ua = new LWP::UserAgent; 9. 10. $ENV{HTTPS_PROXY} = 'http://westproxy:8080'; 11. $ENV{HTTPS_PROXY_USERNAME} = "UserName"; 12. $ENV{HTTPS_PROXY_PASSWORD} = "PWD"; 13. #$ENV{HTTPS_CA_FILE} = ??? 14. 15. #$ua->proxy(https => 'http://westproxy:8080'); 16. my $req = new HTTP::Request('GET'=>$url); 17. my $res = $ua->request($req); 18. 19. if ($res->is_success){ 20. print "Content: \n", $res->content, "\n"; 21. }
If I uncomment line #15, $ua->proxy(https => 'http://westproxy:8080'). I got another message "Denied Access. Use PAC file in the browser settings to ensure that requests for internal web sites do not traverse the Enterprise proxies". Do I need to set HTTPS_CA_FILE ENV? If I do, is it the certificate of our website? Thanks.

Replies are listed 'Best First'.
Re: Access to https page.
by wind (Priest) on Feb 24, 2011 at 02:41 UTC

    Based off the error message alone, why not change your url to 'https://westproxy:8080', if it really is an ssl server?

    Of course giving it an explicit https isn't necessary if you're stating the port, but there might basic error checking.

    - Miller

      Specifying the correct Method -- "https://" in this case -- is definitely necessary.

      The agent code would infer the default TCP port based on the method. But it certainly will not infer the method to be used based on the port. (The method is explicitly given.) The OP seems to know the server is listening on 8080, so it should be "https://yaddayadd:8080". That being said, it's not common for https to be on 8080. So maybe the OP has two problems; using "http://" when it should be "https://" *and* aiming at TCP/8080 when it's actually somewhere else.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://889891]
Approved by ikegami
[LanX]: pm != tk ;)
[Corion]: zentara: Most likely they used something like [http://www. node=123456] instead of [id://123456], which uses whatever domain you're visiting from
[LanX]: hmm... Actually this could be used for a phishing exploit ...
[LanX]: ... well like always :)
[zentara]: LanX One day, I will see a great interest in Tk. It's small, self-contained, needs very few external libraries, AND makes it easy to make high-contrast displays. :-)
[zentara]: Corion in this cased they left the www. out
[zentara]: /d// :-)

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2017-05-26 12:38 GMT
Find Nodes?
    Voting Booth?