Commit Graph

224 Commits

Author SHA1 Message Date
Joe Hoyle
0f9b770b6c Add response status code aliases on WP_Http for convenience.
These provide a more descriptive way to set response codes elsewhere,
so it's readable and less chance for the wrong response code to be
used such as 401 vs 403.

Props rmccue for the idea.
Fixes #35426.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-14 03:16:27 +00:00
John Blackbourn
0003a004db Docs: Miscellaneous docblock code quality tweaks.
See #32246

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


git-svn-id: http://core.svn.wordpress.org/trunk@36039 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-23 07:53:26 +00:00
Drew Jaynes
0404082b18 Docs: Syntax fixes for deprecating WP_Http::parse_url().
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35339 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-23 15:43:24 +00:00
Dion Hulse
7912c647ae WP_HTTP: Promote the WP_HTTP::parse_url() method to a more generic wp_parse_url() function.
Fixes #34408

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


git-svn-id: http://core.svn.wordpress.org/trunk@35333 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-23 05:54:25 +00:00
Scott Taylor
5acee30d9d Docs: object != class
See [33893] et al.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34549 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-26 07:04:28 +00:00
Drew Jaynes
4c7a4bfb25 Docs: Improve the summary and description for the pre_http_request filter docs to better illustrate expected values.
The filter explicitly expects one of three passed value types:

*  An array containing 'headers', 'body', 'response', 'cookies', and 'filename' elements
*  A `WP_Error` instance
*  Boolean false (to avoid short-circuiting the response)

Props johnbillion.
Fixes #33995.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-24 18:52:25 +00:00
John Blackbourn
fdb8400379 Place the filter docblock for http_api_transports immediately above the filter.
See #33413
Props dd32

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


git-svn-id: http://core.svn.wordpress.org/trunk@34142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-15 08:12:25 +00:00
Scott Taylor
3a0db2a22f Fix the case-sensitivity of some HTTP class usage.
See #33413.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34091 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-14 17:37:25 +00:00
Drew Jaynes
853fd32e88 Docs: Add a missing file header for wp-includes/class-http.php.
Also clarifies the class DocBlock summary for `WP_Http` to more clearly describe its purpose.

See #33413. See #33701.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-03 03:39:21 +00:00
Scott Taylor
7c8c216bec HTTP: move classes into their own files, http.php loads the new files, so this is 100% BC if someone is loading http.php directly. New files created using svn cp.
`class-http.php` requires functions from `http.php`, so loading it by itself wouldn't have worked.

Creates: 
`class-wp-http-cookie.php` 
`class-wp-http-curl.php` 
`class-wp-http-encoding.php` 
`class-wp-http-proxy.php` 
`class-wp-http-streams.php` 
`http-functions.php` 

`WP_Http` remains in `class-http.php`.

`http.php` contains only top-level code. Class files only contain classes. Functions file only contains functions.

See #33413.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33716 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-26 03:55:21 +00:00
Scott Taylor
a0e373ef80 For doc block types, favor bool over the few remaining booleans
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32935 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-27 01:03:25 +00:00
Dion Hulse
6657e42c7d WP_HTTP: ensure that the temporary file is created within the temporary directly when stream is specified without a filename parameter.
Fixes #32549

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


git-svn-id: http://core.svn.wordpress.org/trunk@32682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-09 03:55:27 +00:00
Scott Taylor
19a3aacc94 Add @static* annotations where they are missing.
Initialize all static vars that are not, most to `null`.

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 15:43:29 +00:00
Scott Taylor
082bfab426 Clean up @global doc blocks/imports for class-wp-customizer-*.php and friends.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-22 05:06:25 +00:00
Scott Taylor
d577c673e2 self should be used for accessing local static members.
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-09 02:22:26 +00:00
Scott Taylor
0ec87e4584 There are a few functions that have the ability to return false instead of a string, so the return value should be checked before being passed to functions that expect string.
These are trivial, but they clear out some Scrutinizer issues.

See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-09 02:11:28 +00:00
Dion Hulse
65e7885c01 HTTP API: Fix an issue where the limit_response_size parameter wasn't working properly with large documents and the cURL transport.
Fixes #31172

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


git-svn-id: http://core.svn.wordpress.org/trunk@31271 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-29 03:58:23 +00:00
Scott Taylor
0a511680f4 Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value. Constructors do not have meaningful return values, anything that is returned from here is discarded.
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31107 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-10 06:54:23 +00:00
Scott Taylor
60b0cd7943 The keyword elseif should be used instead of else if so that all control keywords look like single words.
This was a mess, is now standardized across the codebase, except for a few 3rd-party libs. 

See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 07:05:25 +00:00
Drew Jaynes
0cbaa88027 Fix a typo in the DocBlock for WP_Http_Curl::$bytes_written_total introduced in [29968].
Props kpdesign.
See #26726.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-07 05:16:24 +00:00
Scott Taylor
e619abda6e Improve various @param docs for src/wp-includes/*.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-01 01:34:24 +00:00
Drew Jaynes
9dcb6daec2 4.1 Docs Audit: Fix some line-wrapping in the DocBlock for WP_Http::parse_url().
See #30469.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30594 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-28 09:14:23 +00:00
Drew Jaynes
8f6188ae53 Ensure inline code is markdown-escaped as such, and that code snippets in descriptions are properly indented.
Affects DocBlocks for the following core elements:
* Two arguments in `_walk_bookmarks()`
* A code snippet in the class header for `WP_Roles`
* A code snippet in the class header for `WP_HTTP_Proxy`
* Inline code fixes in the summary and a parameter description for `WP_oEmbed::discover()`
* An argument description in `_WP_Editors::parse_settings()`
* Inline code fixes in the summary and a parameter description the `embed_oembed_discover` hook.

Props rarst.
See #30473.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30525 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-24 04:42:22 +00:00
Drew Jaynes
f8657d5890 Remove redundant and erroneous @uses tag from most core inline documentation.
Per our inline documentation standards, no further use of the `@uses` tag is recommended as used and used-by relationships can be derived through other means. This removes most uses of the tag in core documentation, with remaining tags to be converted to `@global` or `@see` as they apply.

Fixes #30191.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-30 01:05:24 +00:00
Dion Hulse
2e30f3d891 HTTP API: Support both the 'limit_response_size' and 'stream' parameters at the same time, allowing a partial file download.
Fixes #26726

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


git-svn-id: http://core.svn.wordpress.org/trunk@29714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-20 07:32:21 +00:00
Dion Hulse
659a6b3838 Add some unit tests for WP_HTTP::parse_url() to cover the <PHP 5.4.7 compatibility alterations.
These unit tests cover the expected vehaviour of certain combinations of URL's, but makes no attempt to test invalid URL structures, as PHP's behavious for invalid URL's is undefined (Some will be treated as paths, others fail, and it varies between PHP 5.4.7+ and <5.4.7).
This change also makes WP_HTTP::parse_url() protected in order to allow unit testing.
See #28001, #29886

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


git-svn-id: http://core.svn.wordpress.org/trunk@29624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-09 03:01:18 +00:00
Dion Hulse
dbb6750bb2 Handle deficiencies in PHP's parse_url in older versions of PHP (<5.4.7) in WP_HTTP::make_absolute_url().
In older versions of PHP:
- parse_url() will fail to parse a url where the scheme break (://) is present in a relative URL's path
- parse_url() will include the hostname of a schemeless URL in the path component

This handles those two types of URL's by correcting the response from parse_url().

Fixes #28001, #29886

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


git-svn-id: http://core.svn.wordpress.org/trunk@29621 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-09 01:11:18 +00:00
Dion Hulse
98ff88518a Avoid a PHP Notice when requesting a url without a path component (http://example.com) in the Streams HTTP component.
Props barrykooij for inital patch; Fixes #27668

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


git-svn-id: http://core.svn.wordpress.org/trunk@29616 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-08 06:44:19 +00:00
Dion Hulse
f09c515ad9 When making a HTTP request to a non-standard port, include the port in the Host header for the Streams HTTP transport. This bring parity to the cURL transport and respects the HTTP RFC.
Props kamelkev for the initial patch; Fixes #28982

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


git-svn-id: http://core.svn.wordpress.org/trunk@29615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-08 06:15:18 +00:00
Dion Hulse
78f4cd2c58 Correctly support Schemeless URLs in WP_HTTP::make_absolute_url() by respecting the 'host' field if present in the relative url.
Fixes #29886

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


git-svn-id: http://core.svn.wordpress.org/trunk@29614 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-08 05:58:19 +00:00
Dion Hulse
9962cefbec Correctly handle url's containing url's in WP_HTTP::make_absolute_url().
A valid relative URL could be mistaken for an absolute url if it contained a :// in any position of the url.
Fixes #28001

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


git-svn-id: http://core.svn.wordpress.org/trunk@29613 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-08 05:38:18 +00:00
Dion Hulse
88b635245a Always cast the 'code' server response to an int, this provides consistency between both of the HTTP transports.
Previously cURL would return an int and Streams a numeric string.
Fixes #28887

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


git-svn-id: http://core.svn.wordpress.org/trunk@29612 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-08 05:21:19 +00:00
Dion Hulse
88ceaba2d2 Return the correct server response for the 'message' response field from the server.
Previously this would use the generic message corresponding to the response code, which isn't always accurate. Since we're already parsing the headers, we can simply return that directly (This also has the benefit that it's the same code for both Streams and Curl header handling).
Fixes #28919

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


git-svn-id: http://core.svn.wordpress.org/trunk@29611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-08 05:19:20 +00:00
Mark Jaquith
e1f2b3b9e2 Use HTTPS URLs for trac.wordpress.org (and use core.trac.wordpress.org)
see #27115
Built from https://develop.svn.wordpress.org/trunk@29789


git-svn-id: http://core.svn.wordpress.org/trunk@29561 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-29 13:37:16 +00:00
Mark Jaquith
0d3b83551f Use HTTPS URLs for core.trac.wordpress.org
see #27115
Built from https://develop.svn.wordpress.org/trunk@29788


git-svn-id: http://core.svn.wordpress.org/trunk@29560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-29 13:28:16 +00:00
Sergey Biryukov
3cdc7b1679 Avoid PHP notices when checking for local requests in in WP_Http.
props markoheijnen.
fixes #29392.
Built from https://develop.svn.wordpress.org/trunk@29661


git-svn-id: http://core.svn.wordpress.org/trunk@29435 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-02 02:06:17 +00:00
Drew Jaynes
d33c807723 Fix some documentation typos in various core files.
Props vlajos.
Fixes #29199.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29257 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-13 03:56:17 +00:00
Drew Jaynes
61b8ba8461 Convert documentation for default arguments in WP_Http::request() to a hash notation.
Also update corresponding docs for functions that leverage its arguments.

See #28298.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29014 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-18 22:01:15 +00:00
Drew Jaynes
f35e168f39 Fix syntax for single- and multi-line comments in wp-includes/class-http.php.
See #28943 and #28931.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29013 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-18 21:47:15 +00:00
John Blackbourn
4b31a9143a Update some inline docs for the WP_Http class. Fixes #28943.
Built from https://develop.svn.wordpress.org/trunk@29223


git-svn-id: http://core.svn.wordpress.org/trunk@29007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-18 18:15:15 +00:00
Drew Jaynes
cf17bd6e5e Convert default arguments documentation for WP_Http_Cookie::__construct() into a hash notation.
Props coffee2code for the initial patch.
See #28841.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-11 22:50:15 +00:00
Sergey Biryukov
4d9286ad21 Avoid a PHP notice and warning on language selection screen.
props meekyhwang.
fixes #28648.
Built from https://develop.svn.wordpress.org/trunk@28865


git-svn-id: http://core.svn.wordpress.org/trunk@28665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-27 00:25:15 +00:00
Scott Taylor
d6e5fcab4d Add access modifier to methods of HTTP classes. There are no new private or protected methods, so no need for __call().
See #27881, #22234.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-19 05:34:15 +00:00
Scott Taylor
5bd852c262 In WP_Http_Curl::request(), $theResponse is unused. There are other curl_exec() calls that do not return as well.
See #27882.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28145 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-06 18:26:14 +00:00
Drew Jaynes
7b73dd328e Fix a typo in the PHPDoc description for the WP_Http_Curl->max_body_length property.
Props eightface.
Fixes #27681.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-05 05:48:18 +00:00
Andrew Nacin
755018876c Add context to an internal HTTP API hook.
props kovshenin.
fixes #27021.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27319 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-08 21:54:15 +00:00
Drew Jaynes
cb8951b0b3 Remove all @package and @subpackage PHPDoc tags not at the file- or class-levels in core.
See #27200.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-25 17:14:14 +00:00
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
nacin
86d87dd786 Fix typo in HTTP docblock. props ocean90. fixes #21215.
git-svn-id: http://core.svn.wordpress.org/trunk@21290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-20 15:09:11 +00:00
markjaquith
d65e49c9f3 Bunch of PHPDoc corrections and cleanups. props c3mdigital. props SergeyBiryukov. fixes #21149
git-svn-id: http://core.svn.wordpress.org/trunk@21241 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-09 05:03:53 +00:00
dd32
251719c5e5 WP_HTTP: Add a @link to the Chunked Decode RFC for documentation of how to decode the data correctly. Props mailnew2ster. Fixes #14184
git-svn-id: http://core.svn.wordpress.org/trunk@21231 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-08 05:34:47 +00:00