Tech W. <tech...@yahoo.com.cn> asked:
> I created a script for checking HTTP like below:
> 
> use strict;
> use IO::Socket;

You should use libwww-perl (the LWP::* module family) instead. Not only does it 
save you from re-inventing the wheel, but it also helps you to avoid all of the 
pitfalls of lowlevel socket programming.

But if you absolute must do it yourself, then you should at least read the 
relevant standards.

> 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" ?

From RFC 2616:

"HTTP/1.1 defines the sequence CR LF as the end-of-line marker for all protocol 
elements except the entity-body (see appendix 19.3 for tolerant applications)."

HTH,
Thomas

Reply via email to