in reply to Re: Downloading first X bytes of a file
in thread Downloading first X bytes of a file
print $sock "GET http://www.google.de/index.html\n";
Since you don't send a Hostname-header, you should send at least the HTTP/1.0 version string. And don't you need two newlines at the end, end perhaps a few carriage returns as well?
Also note that there is more to getting web pages than sending one line of HTTP header. Your example won't follow redirects, for one thing, doesn't have error handling etc. There's a reason we use modules to abstract that stuff away.
Besides, IMHO it's not very friendly to request a full page (no range header present) and then only read a part of the reply.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Downloading first X bytes of a file
by misc (Friar) on Jun 09, 2008 at 13:00 UTC |