Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid


by dsb (Chaplain)
on May 16, 2007 at 15:37 UTC ( #615812=perlquestion: print w/replies, xml ) Need Help??
dsb has asked for the wisdom of the Perl Monks concerning the following question:

Hi everybody, I'm currently using LWP to try and connect to an XML page via SSL. I do have to go through a proxy for name resolution since I'm connecting from a closed network. I get this response:
HTTP/1.1 500 Server Error Connection: close Date: Wed, 16 May 2007 15:23:37 GMT Server: NetCache appliance (NetApp/5.6.1D25DEBUG3) Content-Length: 284 Content-Type: text/html Client-Date: Wed, 16 May 2007 15:23:38 GMT Client-Peer: Client-Response-Num: 1 Title: 500 Server Error <HTML> <HEAD><TITLE>500 Server Error</TITLE></HEAD> <BODY> <H1>Server Error</H1> <H4> The following error occurred:<P> [code=PARENT_NEEDED] Unable to service this URL without parent cache.C +ontact your system administrator. </H4> <HR> Please contact the administrator. </BODY> </HTML>
Information on how to resolve this, especially regarding Perl, is scarce.

I'm using Perl 5.8.8, on a Solaris 10 system, and as far as I know, all the necessary packages for SSL support (Crypt::SSLeay and OpenSSL) are installed.

The code (cleansed of real world information):

use strict; use LWP; my $ua = LWP::UserAgent->new(); $ua->proxy(['http', 'https'], 'http://proxy:8080'); my $req = HTTP::Request->new(GET => ''); my $res = $ua->request($req); my $content = $res->as_string;
I've tested the functionality of the proxy hitting so I know I can reach the web, so I'm guessing there IS an issue with the SSL Setup, i just don't know what to check.

Any help is much appreciated.

After poking around some in the Crypt::SSLeay docs, I found that the proxy information needs to be provided through environment variables rather than to the UserAgent object as it is in my original code. So:

Took care of everything.

This @ISA my( $cool ) %SIG

Replies are listed 'Best First'.
by jhourcle (Prior) on May 16, 2007 at 16:37 UTC
    The following error occurred:<P> [code=PARENT_NEEDED] Unable to service this URL without parent cache.C +ontact your system administor

    So, what did your system administrator say?

    Hopefully, they would've told you that you should use an HTTPS proxy for SSL, as to proxy HTTPS using HTTP would create a security risk.

by Krambambuli (Curate) on May 16, 2007 at 16:37 UTC
    Possibly just the way you're trying to get to the site ? Did you try to prefix the URLs you're using (for proxy as for final destination) with 'https://' instead of 'http://' ?
      use Net::SSL (); # From Crypt-SSLeay use LWP::UserAgent; $Net::HTTPS::SSL_SOCKET_CLASS = "Net::SSL"; # Force use of Net::SSL $ENV{HTTPS_PROXY} = ''; $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; my $ua = LWP::UserAgent->new(); my $req = HTTP::Request->new('GET',''); my $res = $ua->request($req); print $res->status_line;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://615812]
Approved by kyle
[karlgoethebier]: or no education?
[choroba]: their = his or her
[Discipulus]: anyway once I proposed an automatic font decrease for post below -1, stepping every 5 votes: i'm still thinks it's a good idea but dunno if feasible
[shmem]: ...emulated dual in english
[shmem]: Discipulus: has that been in the CB? or in a PM node proper? for the latter case, can you provide the ID?
[Discipulus]: you seriously can use their in this way in eng?
[Corion]: Meh. $effin_bad_system has an interface breakdown and then loads events in parallel with events overtaking one another instead of being processed sequentially
[shmem]: Discipulus: dunno, but we do all the time ^^
[choroba]: Discipulus I was taught so by a Londoner
[shmem]: Corion: very clear case of missing sequence number

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (11)
As of 2017-05-23 08:19 GMT
Find Nodes?
    Voting Booth?