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

400 (Bad Request) URL must be absolute

534 views
Skip to first unread message

Wes Preston

unread,
May 17, 2002, 12:11:20 PM5/17/02
to
I am getting the following error reported in my browser when I try to run
the script shown below. It sounds more like an Apache problem, but my other
scripts work just fine.

"400 (Bad Request) URL must be absolute"

The URL I put in the browser is: http://192.168.1.2/cgi-bin/testLWP.cgi


testLWP.cgi
-----------------------------
#!c:/Program Files/Perl/bin/perl

use strict;

# Create a user agent object

use LWP::UserAgent;

my $ua = LWP::UserAgent->new;
$ua->agent("MyApp/0.1 ");

my $document = '192.169.1.1//status.htm';

my $req = HTTP::Request->new(GET => $document);
$req->header('Accept' => 'text/html');
$req->authorization_basic('blah', 'blah');

print "Content-type: text/html\n\n";
print $ua->request($req)->as_string;
------------------------------------------------


Anyone have any ideas?

Thanks,

- Wes


--
PLEASE NOTE: comp.infosystems.www.authoring.cgi is a
SELF-MODERATED newsgroup. aa.net and boutell.com are
NOT the originators of the articles and are NOT responsible
for their content.

HOW TO POST to comp.infosystems.www.authoring.cgi:
http://www.thinkspot.net/ciwac/howtopost.html

brian d foy

unread,
May 17, 2002, 12:27:42 PM5/17/02
to
In article <ueaao6h...@corp.supernews.com>, Wes Preston <w...@prestonweb.com> wrote:

> I am getting the following error reported in my browser when I try to run
> the script shown below. It sounds more like an Apache problem, but my other
> scripts work just fine.

> "400 (Bad Request) URL must be absolute"

> my $document = '192.169.1.1//status.htm';


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

you need an absolute URL there.

--
brian d foy <com...@panix.com> - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting Perl CGI scripts - http://www.perl.org/troubleshooting_CGI.html

Wes Preston

unread,
May 17, 2002, 5:28:38 PM5/17/02
to
Yep, got it. Thank you.

Thanks to Randal Schwartz for giving me a hand via e-mail as well.

- Wes


"brian d foy" <com...@panix.com> wrote in message
news:170520021127429944%com...@panix.com...

0 new messages