Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

https request failing

58 views
Skip to first unread message

mike

unread,
Sep 18, 2012, 4:35:08 AM9/18/12
to
Hi,

The script I have below is used o access an internal website with https (so no proxy here).

use LWP::UserAgent;
use LWP::Debug qw(+);

#create User-agent
my $ua = LWP::UserAgent->new;

$ua->no_proxy("<internalsite>.se");


my $url = "http://<internalsite>.se/org.testng.eclipse/site.xml";

my $req = HTTP::Request->new(
GET => $url);


# send request
my $res = $ua->request($req);

# check the outcome
if ($res->is_success) {
print $res->decoded_content;
}
else {
print "Error: " . $res->status_line . "\n";
}

When I execute it I get the following error:

LWP::UserAgent::new: ()
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET http://<internalsite>.se/org.testng.eclipse/site.xml
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::Protocol::collect: read 259 bytes
LWP::UserAgent::request: Simple response: Found
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET https://<internalsite>.se/org.testng.eclipse/site.xml
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::UserAgent::request: Simple response: Internal Server Error
Error: 500 Can't connect to <internalsite>.se/:443 (Bad service '8080/')

Any ideas what the problem can be?

br,

//mike

mike

unread,
Sep 18, 2012, 7:32:58 AM9/18/12
to
Just a quick note. If I put the url in mozilla I can see the content:

<site><description url="http://beust.com/eclipse-old/eclipse-6.3.2.20111203_1323/index.html"/><feature url="features/org.testng.eclipse_6.3.2.20111203_1323.jar" id="org.testng.eclipse" version="6.3.2.20111203_1323"><category name="org.testng.eclipse"/></feature><category-def name="org.testng.eclipse" label="TestNG">
</category-def></site>

br,

//Mike

Eli the Bearded

unread,
Sep 18, 2012, 5:27:12 PM9/18/12
to
In comp.lang.perl.misc, mike <mikaelp...@hotmail.com> wrote:
> The script I have below is used o access an internal website with https
> (so no proxy here).

Yet this looks like a proxy error.

> $ua->no_proxy("<internalsite>.se");
> my $url = "http://<internalsite>.se/org.testng.eclipse/site.xml";
^^^^^^^ ^^^^^
Hmmm. No https there. And no port specified.

> LWP::UserAgent::request: Simple response: Found

Ahh, a redir.

> LWP::UserAgent::send_request: GET
> https://<internalsite>.se/org.testng.eclipse/site.xml
> LWP::UserAgent::_need_proxy: Not proxied
> LWP::Protocol::http::request: ()
> LWP::UserAgent::request: Simple response: Internal Server Error
> Error: 500 Can't connect to <internalsite>.se/:443 (Bad service '8080/')
^^^^^^^^
At this point I'm really curious why the ":443" appears after the "/",
which would imply a port 80 http request for a resource named "/:443".
Which perhaps that server is then trying something and giving the
error you see?

Myself, I'd try to duplicate this with other tools at this point, in
particular non-browsers, in case there is some browser header sniffing
affecting this.

Elijah
------
or check logs on <internalsite>.seif you have access to those

Ben Morrow

unread,
Sep 18, 2012, 5:41:22 PM9/18/12
to

Quoth Eli the Bearded <*@eli.users.panix.com>:
It may also be worth tracking the connection with tcpdump or wireshark
or something similar, or just using the lwp-request tool with the
-uUsSeE options. I suspect what's happening is that internalsite.se is
sending a malformed redirect response.

Ben

Dr.Ruud

unread,
Sep 19, 2012, 11:02:24 AM9/19/12
to
On 2012-09-18 10:35, mike wrote:

> use LWP::UserAgent;
> use LWP::Debug qw(+);
>
> #create User-agent
> my $ua = LWP::UserAgent->new;
>
> $ua->no_proxy("<internalsite>.se");
>
>
> my $url = "http://<internalsite>.se/org.testng.eclipse/site.xml";

The cut lines can be replaced by:

my $res= $ua->get( $url );

> # check the outcome
> if ($res->is_success) {
> print $res->decoded_content;
> }
> else {
> print "Error: " . $res->status_line . "\n";
> }

Also print Dumper( $res ) for details.

--
Ruud


0 new messages