Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^3: Downloading first X bytes of a file

by misc (Pilgrim)
on Jun 09, 2008 at 13:00 UTC ( #691028=note: print w/replies, xml ) Need Help??

in reply to Re^2: Downloading first X bytes of a file
in thread Downloading first X bytes of a file

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..
  • Comment on Re^3: Downloading first X bytes of a file

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://691028]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2018-03-23 04:28 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (288 votes). Check out past polls.