not able to access a URL with LWP::UserAgent.

D

danglesocket

I need to solve this problem with perl, forgive me if it stretches the
'params' of this group. thanks

This problem originated from not being able to access a URL with
LWP::UserAgent.

Error, cant get page https://webpage.jsp -- 302 Moved Temporarily
Aborting at ./curu.pl line 77.
(sorry it's an intranet page,... not available outside)
(yes, i am also using use Crypt::SSLeay for SSL support)

I can access the url/page fine from any GUI browser.

I thought to check lynx: (my only other 'text' based http protocol resource.
(lynx -version has ssl support)
# lynx: Can't access startfile https://webpage.jsp
# HTTP/1.1 302 Moved Temporarily
# Data transfer complete
# HTTP/1.1 302 Moved Temporarily
# Alert!: Redirection limit of 10 URL's reached.

I know this is because of a redirection loop at the start of the url. how
can i write around this?
I even have found out where it's get's re-directed and tried to acces that
directly, no success.

So i can not access the page from any 'text' based script or browser. (?!)
As im reading this, it sounds like a https protocal issue (or ssl) and not a
perl issue but i really
have to solve this issue with perl. - I have to be able to access this page
wtih perl, any ideas?

thank you.






__danglesocket__
 
B

Brian Harnish

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I need to solve this problem with perl, forgive me if it stretches the
'params' of this group. thanks

This problem originated from not being able to access a URL with
LWP::UserAgent.

Error, cant get page https://webpage.jsp -- 302 Moved Temporarily
[snip...]

Try a real URL. Looks like your server is "webpage.jsp", can
you "ping webpage.jsp"? If not then your url is bad. Also, if that is the
server name, try putting a '/' on the end of it, thats the way it should
be.
thank you.
[snip 6 blank lines before your name...]
__danglesocket__

- Brian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/YLauiK/rA3tCpFYRAmLoAKCZB7obGtoi04JqftbmUh4YgvAT6ACfU0ns
rtK7cykR8UTUKWqxCSu6o9A=
=2dX8
-----END PGP SIGNATURE-----
 
D

danglesocket

I need to solve this problem with perl, forgive me if it stretches the
'params' of this group. thanks

This problem originated from not being able to access a URL with
LWP::UserAgent.

Error, cant get page https://webpage.jsp -- 302 Moved Temporarily
[snip...]

Try a real URL. Looks like your server is "webpage.jsp", can
you "ping webpage.jsp"? If not then your url is bad. Also, if that is the
server name, try putting a '/' on the end of it, thats the way it should
be.



Rather than responding with a half assed answer that proves that you didn't
read the question and
tries to make me look like an idiot, either don't respond or offer somthing
more 'insightful'.

original post stated, "I can access the url/page fine from any GUI
browser." and that
(sorry it's an intranet page,... not available outside)

-how would i be able to do that if this was a simple non-existant url
issue.
https://webpage.jsp - i thought it was clear that this was an example, not a
real url, sorry if that wasn't clear.

- i guess i should have used https://example.org/webpage.jsp. - RFC 2606,
Section 3.
or https://localhost/webpage.jsp

thanks anyway.

__danglesocket__
 
B

Brian Harnish

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Rather than responding with a half assed answer that proves that you didn't
read the question and
tries to make me look like an idiot, either don't respond or offer somthing
more 'insightful'.

original post stated, "I can access the url/page fine from any GUI
browser." and that
(sorry it's an intranet page,... not available outside)

-how would i be able to do that if this was a simple non-existant url
issue.
https://webpage.jsp - i thought it was clear that this was an example, not a
real url, sorry if that wasn't clear.

- i guess i should have used https://example.org/webpage.jsp. - RFC 2606,
Section 3.
or https://localhost/webpage.jsp

I read the question. It's often easiest to help solve the problem when you
know what all the variables are in the problem. Perhaps the problem is
with your url (not the one you said, but the one you really did use) and
all the GUI browsers take into account crappy URL's that LWP and Lynx
don't.

And no, it's not clear that you replaced the url when you quoted the rest
of the error message. "Error, cant get page https://webpage.jsp -- 302
Moved Temporarily Aborting at ./curu.pl line 77." If you go around
changing what the error messages say, without explicitly saying you did,
why not change the line number too?

For a starter, try ditching simplifying by ditching the ssl part.

A Half assed answer to a half assed question.

- Brian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/YNcUiK/rA3tCpFYRAuhsAJ9bwRju3+kJj9pjI3wbO35dG/NlJQCfVrKZ
mioQ5Qt69g2NqYq5MvsQtAY=
=HSMu
-----END PGP SIGNATURE-----
 
K

ko

danglesocket said:
Rather than responding with a half assed answer that proves that you didn't
read the question and
tries to make me look like an idiot, either don't respond or offer somthing
more 'insightful'.

Whoa, don't take things so personally...that's harsh, considering two
things:

1. You're asking for free advice.
2. Really don't see where he was trying to make you look like an idiot
or that a 'half assed answer' was offered. Speaking from *personal*
experience (time wasted looking for something complex when something
simple was breaking my script), its best to *first* look at basic
things when debugging.

Not sure if LWP has some kind of redirection limit (I wouldn't think
that it does), but from the lynx error message you got it seems that
the original URL is being redirected a number of times. LWP::UserAgent
follows redirects automatically. If you deal with the redirects
manually, you can trace what's happening along the way:

====CODE
#!/usr/bin/perl -w
use strict;
use LWP;

my $url = 'your_URL_here';
my $ua = LWP::UserAgent->new(
requests_redirectable => [] # don't follow redirects
);
my @urls = ($url);
while ( @urls ) {
my $r = $ua->head( shift @urls );
if ($r->is_redirect) {
print $r->status_line, "\n"; # server response
print "Redirected: ", $r->header('location'),"\n"; # redirect URL
push @urls, $r->header('location');
}
}

Then you can see the URL of each redirect, and hopefully, where the
problem is occurring.

HTH - keith
 
D

danglesocket

ko<[email protected]> 9/11/2003 9:16:58 PM >>>
danglesocket said:
Rather than responding with a half assed answer that proves that you didn't
read the question and
tries to make me look like an idiot, either don't respond or offer somthing
more 'insightful'.

Whoa, don't take things so personally...that's harsh, considering two
things:

1. You're asking for free advice.
2. Really don't see where he was trying to make you look like an idiot
or that a 'half assed answer' was offered. Speaking from *personal*
experience (time wasted looking for something complex when something
simple was breaking my script), its best to *first* look at basic
things when debugging.


-you're right. thanks for the response. apologies to Brian, thanks for the
suggestions.





__danglesocket__
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top