Commit Graph

206 Commits

Author SHA1 Message Date
Sergey Biryukov fff6cc8fc8 Docs: Change `$args` to `$r` in the DocBlock for `http_api_debug` filter to match the variable name.
Props bor0, ronakganatra.
Fixes #41379.
Built from https://develop.svn.wordpress.org/trunk@41562


git-svn-id: http://core.svn.wordpress.org/trunk@41395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-22 09:33:47 +00:00
Drew Jaynes 8e71c49a12 Docs: Add missing documentation for the `$data` parameter for `WP_Http::browser_redirect_compatibility()`.
Props ronakganatra for the initial patch.
Fixes #41380.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-03 15:24:44 +00:00
Drew Jaynes 0860bb2771 Docs: Remove `@access` notations from method DocBlocks in wp-includes/* classes.
Prior to about 2013, many class methods lacked even access modifiers which made the `@access` notations that much more useful. Now that we've gotten to a point where the codebase is more mature from a maintenance perspective and we can finally remove these notations. Notable exceptions to this change include standalone functions notated as private as well as some classes still considered to represent "private" APIs.

See #41452.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-27 00:41:44 +00:00
Sergey Biryukov 54b8dafd62 Docs: Change `@version` entry for `WP_Http::buildCookieHeader()` to `@since`.
See #41381.
Built from https://develop.svn.wordpress.org/trunk@41105


git-svn-id: http://core.svn.wordpress.org/trunk@40945 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-20 13:15:43 +00:00
Sergey Biryukov 2026da9512 Docs: Add `@access` entries for `WP_Http::block_request()`, `::handle_redirects()`, and `::is_ip_address()`.
Props ronakganatra.
Fixes #41381.
Built from https://develop.svn.wordpress.org/trunk@41104


git-svn-id: http://core.svn.wordpress.org/trunk@40944 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-20 13:14:44 +00:00
Sergey Biryukov 332884f8dc Docs: Add a missing quote in `user-agent` argument description in `WP_Http::request()`.
Props ixkaito.
Fixes #41154.
Built from https://develop.svn.wordpress.org/trunk@40934


git-svn-id: http://core.svn.wordpress.org/trunk@40784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-25 07:00:42 +00:00
Pascal Birchler 76d77e927b Improve redirect handling
Built from https://develop.svn.wordpress.org/trunk@40689


git-svn-id: http://core.svn.wordpress.org/trunk@40552 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-16 08:38:42 +00:00
Dion Hulse 35a0240fb2 WP_HTTP: Map internal Requests hooks to WordPress actions.
This change introduces a `requests-{$hook}` action which can be used to hook into Requests hooks, and restores the `http_api_curl` action.

Props rmccue.
Fixes #37843.

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


git-svn-id: http://core.svn.wordpress.org/trunk@39152 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-13 10:36:29 +00:00
Dion Hulse 7ac6b18d89 HTTP: Call `mbstring_binary_safe_encoding()` before making a request with Requests to avoid issues with `mbstring.func_overload`.
Props SergeyBiryukov.
Fixes #38226.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38837 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-25 00:45:29 +00:00
Dion Hulse d317fa487f HTTP: Update Requests to master (0048f3c) which fixes a number of outstanding issues.
Fixes #38070, #37733 by reverting part of [38429] and using the fix in Requests.
Fixes #37992 allowing for connecting to SSL resources on ports other than 443.
Fixes #37991 by not sending default ports in the `Host:` header.
Fixes #37839 to match and decode Chunked responses correctly.
Fixes #38232 allowing a SSL connection to ignore the hostname of the certificate when verification is disabled.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38670 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-05 03:24:37 +00:00
Scott Taylor a3ffebce30 Bootstrap: do not go gentle into that good night r38411, r38412, and parts of r38389.
See #36335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 16:31:29 +00:00
Scott Taylor 9383bf8f74 General: use `get_bloginfo( 'version' )` instead of `global $wp_version` in several locations - excluding those locations which reload `version.php` mid-flight.
See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 05:49:37 +00:00
Dion Hulse 30270d851f HTTP: Accept non-string values in cookies, fixing a regression since 4.5.
Props swissspidy.
Fixes #37768 for trunk.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38371 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-29 02:42:45 +00:00
Dion Hulse e45ebb28f2 HTTP: Handle an edgecase within the URI parsing library included in Requests, where if a double slash exists at the start of the path the URL is passed to cURL malformed.
Props flixos90 for initial patch.
Fixes #37733 for trunk.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38370 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-29 02:33:34 +00:00
Scott Taylor 390ceba6c7 Bootstrap: after r38409 and r38410, revert r38402 which reverted r38399.
This fixes the paths in `wp-vendor/` that were including `src`. I want to drop this in so we can find out what else will break.

See #36335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 22:32:37 +00:00
Dion Hulse 0e31a46161 Bootstrap: Revert [38399] as it's broken `/build/` and subsequently core.svn.wordpress.org.
The generated classmaps reference `/src/` files and operates in the assumption that the base directory is one level above `wp-settings.php`, which it isn't after our build processes are run.

See #36335

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


git-svn-id: http://core.svn.wordpress.org/trunk@38343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 14:37:32 +00:00
Scott Taylor 6a529648cf Bootstrap: Autoload classes using a Composer-generated PHP 5.2-compatible Autoloader.
* `wp-admin` and `wp-includes` are scanned for classes to autoload
* Several 3rd-party and Ryan McCue-shaped libraries are excluded when the classmap is generated, see `composer.json`: `autoload.exclude-from-classmap`
* `wp-vendor/autoload_52.php` is included at the top of `wp-settings.php` - no changes need to be made to unit tests to include the autoloader
* An avalanche of `require()` and `require_once()` calls that loaded class files have been removed from the codebase.

The following files have been added to `svn:ignore` - they are not 5.2-compatible and fail during pre-commit:
* src/wp-vendor/autoload.php
* src/wp-vendor/composer/autoload_real.php
* src/wp-vendor/composer/autoload_static.php
* src/wp-vendor/composer/ClassLoader.php

We favor these files instead:
* src/wp-vendor/autoload_52.php
* src/wp-vendor/composer/autoload_real_52.php
* src/wp-vendor/composer/ClassLoader52.php

When new PHP classes are added to the codebase, simply run `composer install` or `composer update` from the project root to update the autoloader.

The future is now.

See #36335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 09:15:29 +00:00
Dominik Schilling e64c675fc5 HTTP API: Set `$use_authentication` property of `Requests_Proxy_HTTP` to true when proxy authentication is required.
Props francescobagnoli for initial patch.
Fixes #37494.
Built from https://develop.svn.wordpress.org/trunk@38173


git-svn-id: http://core.svn.wordpress.org/trunk@38114 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-31 18:20:29 +00:00
Dominik Schilling 7e49f103be HTTP API: All non-GET/HEAD requests should put the arguments in the form body.
Requests defaults to _GET/query for HEAD/GET/DELETE and _POST/body for POST/PUT/OPTIONS/PATCH. For backward compatibility `WP_HTTP` needs to force `data_format` to 'body' for all non-GET/HEAD requests.

Props dd32.
Fixes #37456.
Built from https://develop.svn.wordpress.org/trunk@38165


git-svn-id: http://core.svn.wordpress.org/trunk@38106 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-27 15:52:28 +00:00
Dominik Schilling b2607f8d78 HTTP API: Normalize cookies before passing them to Requests.
Requests has its own cookie object in form of `Requests_Cookie`. Therefore we have to convert `WP_Http_Cookie` objects to `Requests_Cookie`.
This introduces `WP_Http_Cookie::get_attributes()` to retrieve cookie attributes of a `WP_Http_Cookie` object and `WP_Http::normalize_cookies()` to convert the cookie objects.

Fixes #37437.
Built from https://develop.svn.wordpress.org/trunk@38164


git-svn-id: http://core.svn.wordpress.org/trunk@38105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-27 15:32:27 +00:00
Dominik Schilling 67de1f07d3 HTTP API: Pass proxy settings to Requests.
`WP_HTTP_Proxy()` is used directly in `WP_Http_Curl()` and `WP_Http_Streams()`. Since `WP_Http::request()` doesn't use them anymore we have to move the proxy handling into `WP_Http::request()` so the proxy data can be passed to `Requests::request()`.

Props rmccue.
See #33055.
Fixes #37107.
Built from https://develop.svn.wordpress.org/trunk@38054


git-svn-id: http://core.svn.wordpress.org/trunk@37995 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-13 15:51:28 +00:00
John Blackbourn 7e7dfdea55 HTTP API: Remove duplicate documentation for the `http_api_debug` hook.
Fixes #37081

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


git-svn-id: http://core.svn.wordpress.org/trunk@37984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-13 10:23:43 +00:00
Ryan McCue ff6a4875a8 HTTP API: Switch back to returning an array.
The array-compatibility object we started returning in r37428 unfortunately isn't enough like an array. In particular, `is_array()` checks fail, despite the object implementing ArrayAccess. Mea culpa.

This moves the WP_HTTP_Response object to a new http_response key in the array, and changes the value back to an actual array.

Fixes #37097.
See #33055.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37930 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 17:51:30 +00:00
Peter Wilson 47d26cd9fb DOCS: Replace HTTP links with HTTPS.
Replaces unsecure links in documentation and translator comments with their secure versions.

Props johnpgreen, netweb

Fixes #36993

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


git-svn-id: http://core.svn.wordpress.org/trunk@37640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-10 04:50:33 +00:00
Drew Jaynes fe3129f470 Docs: Standardize filter docs in wp-includes/class-http.php to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:43:27 +00:00
Ryan McCue 6da21bc4f4 HTTP API: Pass array-like object to http_api_debug.
This was mistakingly passing the Requests_Response object, which caused fatal errors with debugging tools.

See #33055.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37402 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-16 06:12:29 +00:00
Ryan McCue dee1d583a7 HTTP API: Add browser compatibility hook for 3xx redirects.
WordPress erroneously follows browser-style behaviour with 3xx redirects, where a POST to 302 becomes a GET. Requests instead follows the specification and keeps the same method. Requests also exposes a hook to allow changing the behaviour.

[37428] used the wrong method of adding this hook, now corrected.

See #33055.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-13 05:11:27 +00:00
Ryan McCue 37f6e6813a HTTP API: Replace internals with Requests library.
Requests is a library very similar to WP_HTTP, with a high level of unit test coverage, and has a common lineage and development team. It also supports parallel requests.

See #33055.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37394 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-13 04:42:28 +00:00
Drew Jaynes fe3b007fdd Docs: Remove inline `@see` tags from function, class, and method references in inline docs.
Known functions, classes, and methods are now auto-linked in Code Reference pages following #meta1483.

Note: Hook references are still linked via inline `@see` tags due to the unlikelihood of reliably matching for known hooks based on a RegEx pattern.

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-02 04:00:28 +00:00
John Blackbourn 5edba14d1a HTTP API: Add the missing `1xx` HTTP response codes as constants of the `WP_Http` class, and add tests to ensure all available response codes are covered.
Fixes #36294

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


git-svn-id: http://core.svn.wordpress.org/trunk@36716 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-28 01:46:26 +00:00
Eric Lewis 22467e840f Networks and sites: Replace "blog" usage with "site" in docs.
Multisite functions use the term "blog" to refer to what we now call a "site," e.g. `get_current_blog_id()`. These functions are here to stay because of our commitment to backwards compatibility. What we can do is set the documentation straight.

See #35417.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36383 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-28 03:35:27 +00:00
Drew Jaynes 42caba7134 Docs: Update the `@access` tag value for `WP_Http::_get_first_available_transport()` from `private` to `public`.
When the method was introduced in [17914], the name was underscore-prefixed as is core style for private-use, though it was also introduced with a `public` access modifier for the declaration. Due to core's committment to backward-compatibility, the access modifier overrules in this case, meaning that while the method is underscore-prefixed and was originally-intentioned to be private, it is and always will be a public method, and the documentation should reflect that.

Props Frozzare.
Fixes #35289.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36334 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-20 18:46:26 +00:00
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 `boolean`s
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