Tech W. wrote:
Hello,

Hello,

I created a script for checking HTTP like below:

use strict;
use IO::Socket;

my $host = shift || '127.0.0.1';
my $port = shift || 80;

my $sock=IO::Socket::INET->new(PeerAddr => $host,
                               PeerPort => $port,
                               Proto    => 'tcp');
unless (defined $sock) {
  exit -1;
}


print $sock "GET / HTTP/1.0\n\n";

...

For above line, if the remote server OS is Windows, should I send "GET
/ HTTP/1.0\r\n\r\n" instead of "GET / HTTP/1.0\n\n" ?

If yes, then the check script seems not useful, because before each
checking, we must know what the OS of remote server is.

Please give the suggestion.

According to RFC 2616 (http://www.rfc-editor.org/rfc/rfc2616.txt) the end-of-line marker is CRLF which is not dependent on the OS.

AFAIK most TCP protocols use this end-of-line marker.



John
--
Those people who think they know everything are a great
annoyance to those of us who do.        -- Isaac Asimov

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to