Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

SSL acces through proxy: Unable to service this URL without parent cache
Hello,

when I try SSL access over a proxy, I get the following error message
from the proxy:


Unable to service this URL without parent cache.Contact your system
administrator.


Here is what I try to do:


#! /usr/bin/perl

use strict;
use warnings;

my $conf = {
proxy      => "http://proxy.domain.de:81",
proxy_user => "proxyuser",
proxy_pass => "proxysecret",
"ssl-authority-files" => "/etc/ssl/root.pem",

noproxy    => "localhost,localdomain",
user       => "user",
pass       => "secret",
};

{
use LWP::UserAgent;
use LWP::Debug("+", "+conns");
package EditSslAgent;

{ no strict; @ISA = qw(LWP::UserAgent); }

sub get_basic_credentials {
my ($self, $realm, $uri, $isproxy) = @_;
my ($user, $pass);
my $myrealm = sprintf ("<%s://%s> %s",
$uri->scheme(),
$uri->host_port(),
$realm);

print "request credentials $myrealm $isproxy\n";

if ($isproxy) {
$user = $conf->{"proxy_user"};
$pass = $conf->{"proxy_pass"};
} else {
$user = $conf->{"user"};
$pass = $conf->{"pass"};
}

return () unless defined $user && defined $pass;

print "provide credentials for $user\n";

return ($user, $pass);
}
}

$ENV{HTTPS_DEBUG}   = 1;
$ENV{HTTPS_CA_FILE} = $conf->{"ssl-authority-files"};
$ENV{https_proxy}   = $conf->{proxy};
$ENV{http_proxy}    = $conf->{proxy};
$ENV{ftp_proxy}     = $conf->{proxy};
$ENV{wais_proxy}    = $conf->{proxy};
$ENV{gopher_proxy}  = $conf->{proxy};
$ENV{no_proxy}      = $conf->{noproxy};

my $ua = new EditSslAgent (agent=>"Netscape/2.1");
$ua->env_proxy;
my $resp = $ua->get("https://google.de/foo/bar");
print $resp->as_string;


And here is the debug output:


LWP::UserAgent::new: ()
LWP::UserAgent::proxy: https http://proxy.domain.de:81
LWP::UserAgent::proxy: gopher http://proxy.domain.de:81
LWP::UserAgent::proxy: http http://proxy.domain.de:81
LWP::UserAgent::proxy: ftp http://proxy.domain.de:81
LWP::UserAgent::proxy: wais http://proxy.domain.de:81
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET https://google.de/foo/bar
LWP::UserAgent::_need_proxy: Proxied to http://proxy.domain.de:81
LWP::Protocol::http::request: ()
LWP::Protocol::collect: read 460 bytes
LWP::UserAgent::request: Simple response: Internal Server Error
HTTP/1.1 500 Server Error
Connection: close
Date: Mon, 24 Apr 2008 01:22:15 GMT
Server: NetCache appliance (NetApp/6.0.6)
Content-Length: 460
Content-Type: text/html
Client-Date: Mon, 24 Apr 2008 01:23:00 GMT
Client-Peer: 192.168.1.28:81
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.Contact
 your system administrator.
</H4>
<HR>
Please contact the administrator.
Generated by proxy in domain
<p>
<td><font face="Arial,Helvetica"><font size="-2"> F proxy
U: proxyuser IP: 192.168.1.12 https://google.de/foo/bar
</font></font></td>
</BODY>
</HTML>


It looks like LWP does a GET request to the proxy instead of a
CONNECT request.

Any ideas what is going wrong here?

Report this thread to moderator Post Follow-up to this message
Old Post
Josef Wolf
05-01-08 12:49 AM


Re: SSL acces through proxy: Unable to service this URL without parent cache
On Wed, Apr 30, 2008 at 09:14:19PM +0200, Josef Wolf wrote:

Are there really no ideas what goes wrong here?

> Hello,
>
> when I try SSL access over a proxy, I get the following error message
> from the proxy:
>
>
>    Unable to service this URL without parent cache.Contact your system
>    administrator.
>
>
> Here is what I try to do:
>
>
>    #! /usr/bin/perl
>
>    use strict;
>    use warnings;
>
>    my $conf = {
>        proxy      => "http://proxy.domain.de:81",
>        proxy_user => "proxyuser",
>        proxy_pass => "proxysecret",
>        "ssl-authority-files" => "/etc/ssl/root.pem",
>
>        noproxy    => "localhost,localdomain",
>        user       => "user",
>        pass       => "secret",
>    };
>
>    {
>        use LWP::UserAgent;
>        use LWP::Debug("+", "+conns");
>        package EditSslAgent;
>
>        { no strict; @ISA = qw(LWP::UserAgent); }
>
>        sub get_basic_credentials {
>            my ($self, $realm, $uri, $isproxy) = @_;
>            my ($user, $pass);
>            my $myrealm = sprintf ("<%s://%s> %s",
>                                   $uri->scheme(),
>                                   $uri->host_port(),
>                                   $realm);
>
>            print "request credentials $myrealm $isproxy\n";
>
>            if ($isproxy) {
>                $user = $conf->{"proxy_user"};
>                $pass = $conf->{"proxy_pass"};
>            } else {
>                $user = $conf->{"user"};
>                $pass = $conf->{"pass"};
>            }
>
>            return () unless defined $user && defined $pass;
>
>            print "provide credentials for $user\n";
>
>            return ($user, $pass);
>        }
>    }
>
>    $ENV{HTTPS_DEBUG}   = 1;
>    $ENV{HTTPS_CA_FILE} = $conf->{"ssl-authority-files"};
>    $ENV{https_proxy}   = $conf->{proxy};
>    $ENV{http_proxy}    = $conf->{proxy};
>    $ENV{ftp_proxy}     = $conf->{proxy};
>    $ENV{wais_proxy}    = $conf->{proxy};
>    $ENV{gopher_proxy}  = $conf->{proxy};
>    $ENV{no_proxy}      = $conf->{noproxy};
>
>    my $ua = new EditSslAgent (agent=>"Netscape/2.1");
>    $ua->env_proxy;
>    my $resp = $ua->get("https://google.de/foo/bar");
>    print $resp->as_string;
>
>
> And here is the debug output:
>
>
>    LWP::UserAgent::new: ()
>    LWP::UserAgent::proxy: https http://proxy.domain.de:81
>    LWP::UserAgent::proxy: gopher http://proxy.domain.de:81
>    LWP::UserAgent::proxy: http http://proxy.domain.de:81
>    LWP::UserAgent::proxy: ftp http://proxy.domain.de:81
>    LWP::UserAgent::proxy: wais http://proxy.domain.de:81
>    LWP::UserAgent::request: ()
>    LWP::UserAgent::send_request: GET https://google.de/foo/bar
>    LWP::UserAgent::_need_proxy: Proxied to http://proxy.domain.de:81
>    LWP::Protocol::http::request: ()
>    LWP::Protocol::collect: read 460 bytes
>    LWP::UserAgent::request: Simple response: Internal Server Error
>    HTTP/1.1 500 Server Error
>    Connection: close
>    Date: Mon, 24 Apr 2008 01:22:15 GMT
>    Server: NetCache appliance (NetApp/6.0.6)
>    Content-Length: 460
>    Content-Type: text/html
>    Client-Date: Mon, 24 Apr 2008 01:23:00 GMT
>    Client-Peer: 192.168.1.28:81
>    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.Co
ntact your system administrator.
>    </H4>
>    <HR>
>    Please contact the administrator.
>    Generated by proxy in domain
>    <p>
>     <td><font face="Arial,Helvetica"><font size="-2"> F proxy
>      U: proxyuser IP: 192.168.1.12 https://google.de/foo/bar
>        </font></font></td>
>    </BODY>
>    </HTML>
>
>
> It looks like LWP does a GET request to the proxy instead of a
> CONNECT request.
>
> Any ideas what is going wrong here?

Report this thread to moderator Post Follow-up to this message
Old Post
Josef Wolf
05-10-08 12:46 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

LibWWW archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 01:06 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.