The key point i was trying to make, is that if your motivation for limiting the size is that you only want to make sure the links are valid (or check the size of the remote content, or find out if it has moved, etc...) you may want to rethink your problem.

A GET request is designed to return all of the data, where as a HEAD request is designed to only ask the server if the item exists, and get back basic meta-data about it. You could change one single line from your existing code (replace "GET" with "HEAD") and achieve yoru desired result. or you could eliminate most of your code alltogether, and re-use the existing functionality provided by LWP.

(As merlyn pointed out, it is definitely possible to limit the response size you are willing to recieve ... but why make the remote server send you any data that you don't acctually want? All you want is the headers, so use a "HEAD" request and ask for only the headers.)


In reply to Re: Re: Re: Limiting the size of a HTTP::Request by hossman
in thread Limiting the size of a HTTP::Request by thatguy

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.