[wp-trac] [WordPress Trac] #23472: Retrieve the first x bytes of a remote file
WordPress Trac
noreply at wordpress.org
Thu Feb 14 01:31:02 UTC 2013
#23472: Retrieve the first x bytes of a remote file
-----------------------------+-------------------------
Reporter: dd32 | Type: enhancement
Status: new | Priority: normal
Milestone: Awaiting Review | Component: HTTP
Version: | Severity: normal
Keywords: has-patch |
-----------------------------+-------------------------
A commonly useful functionality in HTTP clients is to only request the
first x bytes of a document, this can be useful for example, when you only
need to fetch the first few KB of a image so as to determine it's
dimensions from the initial metadata in the file.
At present, we have no way to offer this through WP_HTTP, The attached
patch is a first-scratch effort at adding it. No proper unit tests so far,
just casual testing which confirms it working.
Patch
* Supports all 3 transports
* Handles streaming-to-file as well
* Doesn't include Headers in the byte count
* Works with Redirects
I'll add some Unit tests for this soon hopefully.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/23472>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list