|get_size( URL )||
Fetch the specified absolute URL and return its content length.
The URL can be a string or an URI object. The function tries
the HEAD HTTP method first, and on failure, tries the GET method.
In either case it sets $HTTP_STATUS to the HTTP response code.
If the response does not contain a Content-Length header, the
function takes the size of the message body. If the HEAD method
returned a good status, but no Content-Length header, it retries
with the GET method.
On error, the function set $ERROR to one of these values:
|get_sizes( URL, BASE_URL )||
The get_sizes function is like get_size, although for HTML pages
it also fetches all of the images then sums the sizes of the
original page and image sizes. It returns a total download size.
In list context it returns the total download size and a hash
reference whose keys are the URLs that a browser should download
The ERROR and HTTP_STATUS correspond to the values of $ERROR and $HTTP_STATUS for that URL.
The hash is always returned in list context (a change from version 0.4).
Relative image links resolve accroding to BASE_URL, or by a found BASE tag. See HTML::SimpleLinkExtor.
* if i have to use GET, i should use Byte-Ranges to avoid downloading the whole thing
* add a way to specify Basic Auth credentials
This source is part of a GitHub project:
brian d foy, <firstname.lastname@example.org>
Copyright X 2000-2015, brian d foy <email@example.com>. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|perl v5.20.3||HTTP::SIZE (3)||2015-08-26|