Hi all,

I've tried to make a script that gets a remote html page using IO::Socket.
If I wanted to use (like in some example from books)  GET $path HTTP/1.1,
the script didn't want to work.
But it works OK if I ask for HTTP/1.0.

The strange thing is that the header returned by the Apache Server running
in Windows 2k says that it is HTTP/1.1, even though I've asked for HTTP/1.0.

Of course, this is happening only if I rename the file as index.html.
If I let it as index.shtml, it doesn't work with any method.
It  prints only the first 4 KB of the html file.

Can you tell me why is not working if I try with HTTP/1.1, and why is not
working with .shtml files?

Thanks.

Here is the script:

#!/perl/bin/perl -w

print "Content-type: text/html\n\n";

use IO::Socket;

my $host = "127.0.0.1";
my $path = "/test.html";
my $port = 80;

my $socket = IO::Socket::INET -> new(PeerAddr => $host,
PeerPort => $port,
                                         Proto     => 'tcp',
Type => SOCK_STREAM,
Timeout => 5,
)

               or die "Cannot connect to the server.\n";

$socket->autoflush(1);

#print $socket "GET $path HTTP/1.0\n",
#"Host: $host\n\n";

print $socket "GET /index.shtml\n\n";

my $sock = <$socket>;

while (<$socket>) {
print;
}

$socket->close;

Teddy's Center: http://teddy.fcc.ro/
Mail: [EMAIL PROTECTED]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to