That was my first thought, but breaking the URL into host
and URI didn't solve the issue. If I figure anything else
out, I'll post it here.
Update: sutch seems to have hit the nail on
the head. If you send "GET /authenticate.cgi HTTP/1.0"
alone it errors out. The key is attaching "Host:
login.gatorlink.ufl.edu" to the end of the request, before
your $BLANK variable.
while(my $url = shift @ARGV) {
unless($url =~ m{^http://([A-Za-z0-9\.\-]+)/(.*)$}) {
print "$0: invalid url: $url\n";
next;
}
my($host, $uri) = ($1, $2);
my $remote = IO::Socket::INET->new(Proto => "tcp",
PeerAddr => $host,
PeerPort => "http(80)");
unless ($remote) {
die "Cannot connect to http daemon on $host\n"
}
$remote->autoflush(1);
print $remote "GET /$uri HTTP/1.0\nHost: $host" . $BLANK;
print while(<$remote>);
print "\n$sep";
close $remote;
}
Your end result might look something like that. You really
should just use LWP. =)
'kaboo
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.