Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

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]
[Corion]: A good morning to you too, marto!
[marto]: hey Corion, good weekend?
[prospect]: Thank you
[marto]: no problem prospect
[Corion]: I hope you all spent a good weekend!
[Discipulus]: good morning eumonks!
[Discipulus]: yes thanks, mostly at seaside, but the waterpolo tournemts went bad, very bad.. ;=(
[marto]: hey Discipulus, Corion a reasonable weekend. The boys first trip to the cinema
[Corion]: Discipulus: You got pushed too much under water?

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2017-07-24 08:06 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (348 votes). Check out past polls.