Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: Downloading first X bytes of a file

by misc (Friar)
on Jun 09, 2008 at 13:00 UTC ( [id://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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://691028]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-25 17:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found