Re^3: Downloading first X bytes of a fileby misc (Pilgrim)
|on Jun 09, 2008 at 13:00 UTC||Need Help??|
Yes, you are right about the HTTP protocol.
It's just a quick hack to show how it would work,
after I tested the script successfully I didn't bother to look up the http references...
Lazy as I am I debug my cgi scripts from time to time with telnet this way.
Although I believe to remember if you don't send the HTTP Version the webserver has to assume you are a HTTP/1.0 client.
There's however a reason I suggested to go this way,
It's possible to parse the data you get and to request more if needed.
It's also hard to say which way I would go without knowing about the purpose of reading the first 512 bytes of a page.
Although I believe it's very often better to write your own module,
you'll learn something and sometimes existing modules simply don't do what you expect due to their complexity.
It's also easier to customize your own modules.
I believe closing the socket SHOULDN'T have any effect on the remote server, since it's always possible the connection breaks.
But I agree the script is not very friendly, I also would do some further work before using it..