Commit Graph

127 Commits

Author SHA1 Message Date
Drew Jaynes
9172107539 Inline documentation for hooks in wp-includes/class-http.php.
Props kraftbj for the initial patches. Props kpdesign, DrewAPicture.
Fixes #26049.

Built from https://develop.svn.wordpress.org/trunk@27049


git-svn-id: http://core.svn.wordpress.org/trunk@26923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-28 08:25:11 +00:00
Drew Jaynes
cd8cedc40d First there were two, and now there are three -- in the @since versions that came before and that shall be. And so it will be, says nacin.
Props JustinSainton, SergeyBiryukov, DrewAPicture.
Fixes #26713.

Built from https://develop.svn.wordpress.org/trunk@26868


git-svn-id: http://core.svn.wordpress.org/trunk@26754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-24 18:57:12 +00:00
Andrew Nacin
70fd806759 Revert r25824:25875 from the core.svn.wordpress.org repository.
These commits were accidentally re-synced commits from develop.svn.wordpress.org due to a race condition. Thankfully, the history of this repository matters fairly little. It also happened only for trunk.


git-svn-id: http://core.svn.wordpress.org/trunk@25876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-25 02:29:52 +00:00
Andrew Nacin
8ae8e01b67 Remove the old wp_auto_updates_maybe_update cron event. Schedule the new wp_maybe_auto_update event at 7 a.m. and 7 p.m. in the site's timezone.
see #27704.

Built from https://develop.svn.wordpress.org/trunk@25825


git-svn-id: http://core.svn.wordpress.org/trunk@25825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-24 22:53:14 +00:00
Ryan Boren
b87d4b77e5 Pinking shears
Built from https://develop.svn.wordpress.org/trunk@25880


git-svn-id: http://core.svn.wordpress.org/trunk@25792 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-23 14:38:10 +00:00
Andrew Nacin
d35284e08a Use sentence case.
Built from https://develop.svn.wordpress.org/trunk@25654


git-svn-id: http://core.svn.wordpress.org/trunk@25571 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-02 17:40:10 +00:00
Dion Hulse
ef9b9664e1 WP_HTTP: Fix a typo in the naming of WP_HTTP_Streams::verify_ssl_certificate(). Props SergeyBiryukov See #25007
Built from https://develop.svn.wordpress.org/trunk@25473


git-svn-id: http://core.svn.wordpress.org/trunk@25394 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-18 01:51:10 +00:00
Dion Hulse
c93eb27bb2 Switch WP_HTTP over to using the mbstring.func_overload helper functions. This change moves the check from within the Streaming-handling function to wrap the individual request, this fixes it for both cURL and Streams and any future changes to the transports which use strlen() on binary data. See #25259 See #16057
Built from https://develop.svn.wordpress.org/trunk@25348


git-svn-id: http://core.svn.wordpress.org/trunk@25310 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-11 08:13:10 +00:00
Dion Hulse
3514c7d1c4 WP_HTTP: Correct the @since, and, @deprecated PHPDoc tags to reflect the class history. See #25007
Built from https://develop.svn.wordpress.org/trunk@25309


git-svn-id: http://core.svn.wordpress.org/trunk@25271 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-09 08:10:10 +00:00
Dion Hulse
f66f154ced WP_HTTP: When streaming to file, ensure that fwrite() suceeds and correctly writes the file to disk. Fixes #16057
Built from https://develop.svn.wordpress.org/trunk@25303


git-svn-id: http://core.svn.wordpress.org/trunk@25265 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-09 01:18:08 +00:00
Dion Hulse
19054801bf WP_HTTP: Re-enable curl, it was accidentally left out of [25224]. See #25007 See #16606
Built from https://develop.svn.wordpress.org/trunk@25225


git-svn-id: http://core.svn.wordpress.org/trunk@25195 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-04 04:50:08 +00:00
Dion Hulse
3ac572867e WP_HTTP: Replacing the Fsockopen & Streams Transports with a new Streams transport which fully supports HTTPS communication.
This changeset also bundles ca-bundle.crt from the Mozilla project to allow for us to verify SSL certificates on hosts which have an incomplete, outdated, or invalid local SSL configuration.
Props rmccue for major assistance getting this this far. See #25007 for discussion, also Fixes #16606 

Built from https://develop.svn.wordpress.org/trunk@25224


git-svn-id: http://core.svn.wordpress.org/trunk@25194 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-04 04:49:12 +00:00
Dion Hulse
bb74078a2b WP_HTTP: Add a filter for the available HTTP Transports to allow plugins to alter the order which HTTP Transports are tried, or to add their own.
Built from https://develop.svn.wordpress.org/trunk@25222


git-svn-id: http://core.svn.wordpress.org/trunk@25193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-03 08:39:09 +00:00
Dion Hulse
98104779a3 WP_HTTP: Clean up some comments style and remove outdated information.
The change to the proxy block here is for consistency, WP_HTTP_Proxy::block_request() is never called before parse_url() has successfully operated on the URL, and in the event we cannot read the URL, it shouldn't be requested.

Built from https://develop.svn.wordpress.org/trunk@25221


git-svn-id: http://core.svn.wordpress.org/trunk@25192 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-03 08:37:10 +00:00
Dion Hulse
994033258e WP_HTTP: Make the new 2nd parameter to WP_HTP::processHeaders() as optional. See #21182. Fixes #25179
Built from https://develop.svn.wordpress.org/trunk@25176


git-svn-id: http://core.svn.wordpress.org/trunk@25149 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-30 02:11:09 +00:00
Dion Hulse
f17254a835 WP_HTTP: Fix a variable typo in [25153] See #23463
Built from https://develop.svn.wordpress.org/trunk@25155


git-svn-id: http://core.svn.wordpress.org/trunk@25134 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-28 07:30:08 +00:00
Dion Hulse
5a9ccf9bee WP_HTTP: Update the documentation regarding HTTP/1.1 support. Props leewillis77 Fixes #25074
Built from https://develop.svn.wordpress.org/trunk@25154


git-svn-id: http://core.svn.wordpress.org/trunk@25133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-28 06:55:09 +00:00
Dion Hulse
122c3953d1 WP_HTTP: Improve WP_HTTP::chunkTransferDecode() to properly handle binary data and chunked responses which include data in the page that looks like a chunked response.
This also fixes a case where the gzip'd data would become corrupt after chunked decoding as \r\n was replaced with \n in the data stream. Fixes #23463 

Built from https://develop.svn.wordpress.org/trunk@25153


git-svn-id: http://core.svn.wordpress.org/trunk@25132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-28 06:53:09 +00:00
Dion Hulse
1aecc6c957 WP_HTTP: When requesting a document with HTTP/1.1 include the 'Connection: Close' header (unless a Connection header is already specified) to prevent the connection being held open and hanging the request process. See #23463
Built from https://develop.svn.wordpress.org/trunk@25150


git-svn-id: http://core.svn.wordpress.org/trunk@25129 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-28 04:59:09 +00:00
Dion Hulse
f8e3be14fe WP_HTTP: More relaxed host matching for WP_PROXY_BYPASS_HOSTS and WP_ACCESSIBLE_HOSTS, allowing for subdomains in wildcards to include dashes (and anything else which [\w.] didn't catch). Fixes #24201
Built from https://develop.svn.wordpress.org/trunk@25149


git-svn-id: http://core.svn.wordpress.org/trunk@25128 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-28 04:54:09 +00:00
Sergey Biryukov
db2a73a3f7 Avoid a fatal error in WP_Http::request() if $response is a WP_Error instance. props dllh, nacin. fixes #24987.
Built from https://develop.svn.wordpress.org/trunk@25114


git-svn-id: http://core.svn.wordpress.org/trunk@25095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-24 03:11:10 +00:00
Dion Hulse
e91dcf8fac WP_HTTP: Curl: When using Stream-to-file on servers using mbstring.func_overload ensure that the file is written out correctly. Props DrProtocols. See #25061 for trunk
Built from https://develop.svn.wordpress.org/trunk@25051


git-svn-id: http://core.svn.wordpress.org/trunk@25038 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-18 08:18:10 +00:00
Dion Hulse
ef3b20c949 WP_HTTP: Cookies: When following redirects, include the request cookies in the redirected requests. Fixes #24987
Built from https://develop.svn.wordpress.org/trunk@25046


git-svn-id: http://core.svn.wordpress.org/trunk@25033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-17 01:20:09 +00:00
Dion Hulse
cd0642bdc7 WP_HTTP: Cookies: Fill the defaults for the Cookie object based on the current requested URL. Fixes #21182
Built from https://develop.svn.wordpress.org/trunk@25044


git-svn-id: http://core.svn.wordpress.org/trunk@25031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-17 00:34:10 +00:00
Dion Hulse
da016d59b4 WP_HTTP: Allow name => value pairs to be passed in to the 'cookie' parameter, simplifies plugin code when needing to specify basic cookies. Fixes #21999
Built from https://develop.svn.wordpress.org/trunk@25016


git-svn-id: http://core.svn.wordpress.org/trunk@25008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-08 02:44:09 +00:00
Andrew Nacin
8c7adaa7bd Introduce wp_safe_remote_request(). Also wp_safe_remote_head(), wp_safe_remote_get(), wp_safe_remote_post().
Reverts [24482].

see #24646.



git-svn-id: http://core.svn.wordpress.org/trunk@24894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-30 15:37:01 +00:00
Dion Hulse
94b2ed9164 WP_HTTP: PHPDoc updates for WP_Http::handle_redirects(). Props DrewAPicture. Fixes #16889
git-svn-id: http://core.svn.wordpress.org/trunk@24890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-30 06:47:03 +00:00
Dion Hulse
ac424c08ca WP_HTTP: When multiple location headers are specified, use the last specified location url as the redirect location. Fixes #16890
git-svn-id: http://core.svn.wordpress.org/trunk@24846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-29 02:11:46 +00:00
Dion Hulse
d6656cc1f1 WP_HTTP: Fsockopen: Respect a specified Host header in the Fsockopen WP_HTTP transport. Fixes #24182
git-svn-id: http://core.svn.wordpress.org/trunk@24845 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-29 01:47:01 +00:00
Dion Hulse
c61a2dac03 WP_HTTP: Abstract out the Redirection handling code into it's own method and fix a bunch of redirection edgecases at the same time.
Fixes #17588
Fixes 16889
Props wonderboymusic and kovshenin for initial patches


git-svn-id: http://core.svn.wordpress.org/trunk@24843 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-29 01:19:54 +00:00
Andrew Nacin
5b1817fa4b Rename limit-response-size to limit_response_size. see #23472.
git-svn-id: http://core.svn.wordpress.org/trunk@24767 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-22 18:55:05 +00:00
Andrew Nacin
3be3080228 Broader fix for [24497] for setup-config.php in trunk. props SergeyBiryukov, markoheijnen. fixes #24627.
git-svn-id: http://core.svn.wordpress.org/trunk@24503 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-23 06:02:19 +00:00
Andrew Nacin
6ed3a582ef Only call wp_kses_bad_protocol() in WP_HTTP if it exists. It does not in setup-config.php.
git-svn-id: http://core.svn.wordpress.org/trunk@24497 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-21 19:05:15 +00:00
Andrew Nacin
8b09788c70 Change the HTTP API's URL validation default, in trunk.
git-svn-id: http://core.svn.wordpress.org/trunk@24482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-21 06:17:56 +00:00
Andrew Nacin
96ee267343 Better validation of the URL used in core HTTP requests.
git-svn-id: http://core.svn.wordpress.org/trunk@24480 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-21 06:07:47 +00:00
Ryan Boren
ad4a081c0c Pinking shears
git-svn-id: http://core.svn.wordpress.org/trunk@24303 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-20 12:10:58 +00:00
Dion Hulse
1f7fc4281f WP_HTTP: Prevent the 'max_body_length' and 'stream_handle' properties of the curl class from leaking between requests by specifically initializing them in every case. See #23472 & r23605
git-svn-id: http://core.svn.wordpress.org/trunk@23609 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-04 05:40:43 +00:00
Dion Hulse
d4b814df2f WP_HTTP: Fix returning WP_Error's on too-many-redirects after r23603 See #23682
git-svn-id: http://core.svn.wordpress.org/trunk@23608 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-04 05:17:05 +00:00
Dion Hulse
46a4d2d295 WP_HTTP: Return error responses from cURL for non-blocking requests. Contrary to popular belief, cURL's non-blocking requests are not exact non-blocking, we still wait for cURL to make the request before returning, so making this change aids in development debugging. Props SergeyBiryukov Fixes #23310
git-svn-id: http://core.svn.wordpress.org/trunk@23607 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-04 04:47:39 +00:00
Dion Hulse
324d2a57f0 WP_HTTP: Enable developers to request the first x bytes of a document using the 'limit-response-size' parameter.
The connection to the remote server will be disconnected after x number of bytes has been received.
See #23472


git-svn-id: http://core.svn.wordpress.org/trunk@23605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-04 04:24:26 +00:00
Dion Hulse
0e18d104e1 WP_HTTP: Funnel all redirect requests through WP_HTTP::request() via wp_remote_request() to ensure that the proper transport is chosen for redirects.
This change also moves PHP Streams from redirecting internally, to us handling the redirections in PHP, which brings a more consistent behaviour between transports.
Fixes #23682



git-svn-id: http://core.svn.wordpress.org/trunk@23603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-04 04:10:36 +00:00
Dion Hulse
64bfe1d877 WP_HTTP: Specifically mark a static function as being static
git-svn-id: http://core.svn.wordpress.org/trunk@23602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-04 03:36:08 +00:00
Dion Hulse
2c70f1591b WP_HTTP: Do not send a Accept-Encoding header when we're streaming to file, or decompression has been disabled by the caller, See #22913
git-svn-id: http://core.svn.wordpress.org/trunk@23601 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-04 03:33:12 +00:00
Dion Hulse
78e4b5afde WP_HTTP: Allow developers to specify a Accept-Encoding header. Fixes #20142
git-svn-id: http://core.svn.wordpress.org/trunk@23600 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-04 03:11:25 +00:00
Dion Hulse
50da2d8a9f HTTP API: Introduce wp_is_writable() to wrap win_is_writable() and is_writable() to work around PHP Windows ACL issues. See #22900 for trunk
git-svn-id: http://core.svn.wordpress.org/trunk@23255 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-03 08:04:11 +00:00
Helen Hou-Sandí
b1f1579604 its <=> it's in documentation, along with a rogue the, The, and looses. props trepmal. fixes #22665.
git-svn-id: http://core.svn.wordpress.org/trunk@23191 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-20 15:55:32 +00:00
Ryan Boren
77518e9c71 Objects no longer need to be explicitly passed by ref to call_user_func*() to be callable. Props wonderboymusic. fixes #21865
git-svn-id: http://core.svn.wordpress.org/trunk@22118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-04 20:00:16 +00:00
Dion Hulse
da06db31a3 Avoid a warning in wp_remote_post() when using arrays or objects in the body param by using a more verbose check, introduced with [22047]. See #14184
git-svn-id: http://core.svn.wordpress.org/trunk@22055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-27 10:09:43 +00:00
Dion Hulse
97bfd2db9a Allow wp_remote_post to send a body consisting of entirely '0', which may be used when PUT'ing or POST'ing data to a API which accepts a raw chunk of data rather than key=value pairs (Such as some REST API's). Fixes #14184
git-svn-id: http://core.svn.wordpress.org/trunk@22047 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-27 06:54:17 +00:00
Andrew Nacin
557d9313a7 Introduce constants to allow for easier expression of time periods in seconds. Adds MINUTE_IN_SECONDS, HOUR_IN_SECONDS, DAY_IN_SECONDS, WEEK_IN_SECONDS, YEAR_IN_SECONDS. props nbachiyski, SergeyBiryukov. fixes #20987.
git-svn-id: http://core.svn.wordpress.org/trunk@21996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-25 05:26:19 +00:00