Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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 = "https://encrypted.google.com/"; 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.

Comment on Access to https page.
Download Code
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://889891]
Approved by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2014-08-29 23:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (289 votes), past polls