Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) 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..

In reply to Re^3: Downloading first X bytes of a file by misc
in thread Downloading first X bytes of a file by pc0019

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-04-23 18:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found