Commit Graph

91 Commits

Author SHA1 Message Date
Dion Hulse
5c1c214b26 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: https://develop.svn.wordpress.org/trunk@23609 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-04 05:40:43 +00:00
Dion Hulse
c267aa97a8 WP_HTTP: Fix returning WP_Error's on too-many-redirects after r23603 See #23682
git-svn-id: https://develop.svn.wordpress.org/trunk@23608 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-04 05:17:05 +00:00
Dion Hulse
86a9ca48a1 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: https://develop.svn.wordpress.org/trunk@23607 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-04 04:47:39 +00:00
Dion Hulse
c5ebf25b8e 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: https://develop.svn.wordpress.org/trunk@23605 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-04 04:24:26 +00:00
Dion Hulse
b3e461dddd 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: https://develop.svn.wordpress.org/trunk@23603 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-04 04:10:36 +00:00
Dion Hulse
f936278590 WP_HTTP: Specifically mark a static function as being static
git-svn-id: https://develop.svn.wordpress.org/trunk@23602 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-04 03:36:08 +00:00
Dion Hulse
d15b5ca24b 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: https://develop.svn.wordpress.org/trunk@23601 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-04 03:33:12 +00:00
Dion Hulse
349fb6ed6d WP_HTTP: Allow developers to specify a Accept-Encoding header. Fixes #20142
git-svn-id: https://develop.svn.wordpress.org/trunk@23600 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-04 03:11:25 +00:00
Dion Hulse
80bc158edd 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: https://develop.svn.wordpress.org/trunk@23255 602fd350-edb4-49c9-b593-d223f7449a82
2013-01-03 08:04:11 +00:00
Helen Hou-Sandi
1303e7377a its <=> it's in documentation, along with a rogue the, The, and looses. props trepmal. fixes #22665.
git-svn-id: https://develop.svn.wordpress.org/trunk@23191 602fd350-edb4-49c9-b593-d223f7449a82
2012-12-20 15:55:32 +00:00
Ryan Boren
7ba5099795 Objects no longer need to be explicitly passed by ref to call_user_func*() to be callable. Props wonderboymusic. fixes #21865
git-svn-id: https://develop.svn.wordpress.org/trunk@22118 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-04 20:00:16 +00:00
Dion Hulse
a9f469870d 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: https://develop.svn.wordpress.org/trunk@22055 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-27 10:09:43 +00:00
Dion Hulse
93ba84c528 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: https://develop.svn.wordpress.org/trunk@22047 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-27 06:54:17 +00:00
Andrew Nacin
774a12be83 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: https://develop.svn.wordpress.org/trunk@21996 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-25 05:26:19 +00:00
Andrew Nacin
0887beb1d8 Fix typo in HTTP docblock. props ocean90. fixes #21215.
git-svn-id: https://develop.svn.wordpress.org/trunk@21290 602fd350-edb4-49c9-b593-d223f7449a82
2012-07-20 15:09:11 +00:00
Mark Jaquith
ebcf49cf93 Bunch of PHPDoc corrections and cleanups. props c3mdigital. props SergeyBiryukov. fixes #21149
git-svn-id: https://develop.svn.wordpress.org/trunk@21241 602fd350-edb4-49c9-b593-d223f7449a82
2012-07-09 05:03:53 +00:00
Dion Hulse
fc9df89100 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: https://develop.svn.wordpress.org/trunk@21231 602fd350-edb4-49c9-b593-d223f7449a82
2012-07-08 05:34:47 +00:00
Dion Hulse
77c54f2481 WP_HTTP: Remove a empty() check that would never be empty due to the format of HTTP Headers, value would always contain at least a space followed by the value. See #14184
git-svn-id: https://develop.svn.wordpress.org/trunk@21230 602fd350-edb4-49c9-b593-d223f7449a82
2012-07-08 05:16:26 +00:00
Dion Hulse
28d82c9b04 WP_HTTP: Allow for cookies with "empty" values be sent, this affects sending cookies such as test=0, which would previously fail. Props mailnew2ster for initial patch. See #14184
git-svn-id: https://develop.svn.wordpress.org/trunk@21227 602fd350-edb4-49c9-b593-d223f7449a82
2012-07-07 12:06:09 +00:00
Dion Hulse
ceec50af94 WP_HTTP: Respect that some cookies do not have an expiration time, this is a valid use-case that WP_HTTP_Cookie::test() should not discard, a non-existant expiration date simply means to let it expire at the end of the session. Props mailnew2ster. Fixes #14191
git-svn-id: https://develop.svn.wordpress.org/trunk@21226 602fd350-edb4-49c9-b593-d223f7449a82
2012-07-07 04:23:49 +00:00
Dion Hulse
f2bd679b96 WP_HTTP: Add a filter to WP_HTTP_Proxy::send_through_proxy() to allow for plugins to modify which requests are sent to a proxy dynamically. Fixes #20222
git-svn-id: https://develop.svn.wordpress.org/trunk@21225 602fd350-edb4-49c9-b593-d223f7449a82
2012-07-07 02:27:13 +00:00
Ryan Boren
5e6ed7574c Handle relative urls when processing redirects. Introduce WP_Http::make_absolute_url(). Props dd32. fixes #20434
git-svn-id: https://develop.svn.wordpress.org/trunk@20767 602fd350-edb4-49c9-b593-d223f7449a82
2012-05-10 21:32:02 +00:00
Dion Hulse
95555955d2 WP_HTTP: Curl: $theHeaders is an array, not an object, introduced in [20370]. Props kurtpayne. Fixes #20389 See #20219
git-svn-id: https://develop.svn.wordpress.org/trunk@20399 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-07 07:16:30 +00:00
Peter Westwood
7ffdb1a514 Fix typo in [20372] - See #19922 props SergeyBiryukov.
git-svn-id: https://develop.svn.wordpress.org/trunk@20373 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-05 15:34:28 +00:00
Peter Westwood
35cfb293e7 HTTP: Don't force cookie values to be urlencoded because it breaks usage of cookies in some scenarios like the LiveJournal Importer. Instead add a filter for a plugin to use if it really wants to have the cookie mangled. Fixes #19922 props pw201, dllh and kurtpayne.
git-svn-id: https://develop.svn.wordpress.org/trunk@20372 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-05 15:17:34 +00:00
Dion Hulse
20141db4eb WP_HTTP: Curl: Correct a typo in [20208] causing failed curl requests not to return a WP_Error under certain situations. Props SergeyBiryukov. Fixes #20219
git-svn-id: https://develop.svn.wordpress.org/trunk@20370 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-05 11:58:04 +00:00
Dion Hulse
5e9301f14c WP_HTTP: Curl: Handle Redirections in PHP rather than internally in Curl, Simplifies code flow between safe_mode On and Off, and works around certain bugs. Props simonwheatley for initial patch. Fixes #20219, Fixes #17490
git-svn-id: https://develop.svn.wordpress.org/trunk@20208 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-18 05:00:05 +00:00
Dion Hulse
652212f123 WP_Http: cURL: Use the parsed args $r, rather than the raw $args. Mentioned in #20219
git-svn-id: https://develop.svn.wordpress.org/trunk@20207 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-18 03:12:12 +00:00
Dion Hulse
f2edc4b2c6 WP_HTTP: Send the body with custom method requests when using cURL. Fixes #18589
git-svn-id: https://develop.svn.wordpress.org/trunk@20183 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-15 05:33:38 +00:00
Dion Hulse
0bef3ee02a Support custom HTTP Methods in WP_Http_Curl. Brings it in line with the other HTTP transports of respecting the requested method. Props zx2c4. Fixes #18589
git-svn-id: https://develop.svn.wordpress.org/trunk@19696 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-06 12:53:44 +00:00
Ryan Boren
a8d77cbae9 User lowercase true, false, null instead of uppercase. Props c3mdigital, mfields. fixes #16302
git-svn-id: https://develop.svn.wordpress.org/trunk@19687 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-05 20:50:54 +00:00
Ryan Boren
5e76729992 One newline is enough.
git-svn-id: https://develop.svn.wordpress.org/trunk@19684 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-05 20:10:39 +00:00
Ryan Boren
cb374258bb Remove extraneuos newlines
git-svn-id: https://develop.svn.wordpress.org/trunk@19623 602fd350-edb4-49c9-b593-d223f7449a82
2011-12-21 18:42:11 +00:00
Ryan Boren
676ba7043e Use one space, not two, after trailing punctuation. fixes #19537
git-svn-id: https://develop.svn.wordpress.org/trunk@19593 602fd350-edb4-49c9-b593-d223f7449a82
2011-12-13 23:45:31 +00:00
Ryan Boren
4399cf7610 Avoid E_STRICT notices. see #18975
git-svn-id: https://develop.svn.wordpress.org/trunk@19094 602fd350-edb4-49c9-b593-d223f7449a82
2011-10-31 19:38:46 +00:00
Ryan Boren
fd10e500e4 Pinking shears
git-svn-id: https://develop.svn.wordpress.org/trunk@19054 602fd350-edb4-49c9-b593-d223f7449a82
2011-10-24 19:13:23 +00:00
Dion Hulse
81197a2dd5 Respect the Content-Type header developers pass to WP_HTTP. Fixes #18982
git-svn-id: https://develop.svn.wordpress.org/trunk@19000 602fd350-edb4-49c9-b593-d223f7449a82
2011-10-19 04:48:00 +00:00
Dion Hulse
6069fe3c61 Document the Magic numbering in WP_Http_Encoding::compatible_gzinflate(). Fixes #18273
git-svn-id: https://develop.svn.wordpress.org/trunk@18806 602fd350-edb4-49c9-b593-d223f7449a82
2011-09-29 02:10:35 +00:00
Dion Hulse
36f2e9a22f Pass $args and $url to the http_api_debug action to improve debugging. Props johnbillion. Fixes #18732
git-svn-id: https://develop.svn.wordpress.org/trunk@18805 602fd350-edb4-49c9-b593-d223f7449a82
2011-09-29 01:42:09 +00:00
Dion Hulse
d07aeb8b07 Add inflation support for java.util.zip.Deflater in WP_Http_Encoding::compatible_gzinflate(). Fixes #18273
git-svn-id: https://develop.svn.wordpress.org/trunk@18718 602fd350-edb4-49c9-b593-d223f7449a82
2011-09-19 14:43:43 +00:00
Jon Cave
205aa5ba5c Fix typos in documentation (wp-includes/[a-h]). See #18560.
git-svn-id: https://develop.svn.wordpress.org/trunk@18633 602fd350-edb4-49c9-b593-d223f7449a82
2011-09-03 16:02:41 +00:00
Ryan Boren
90ec88ca6e Empty headers instance var instead of unsetting to avoid warning. Props chrisbliss18. fixes #18157
git-svn-id: https://develop.svn.wordpress.org/trunk@18457 602fd350-edb4-49c9-b593-d223f7449a82
2011-07-21 21:44:35 +00:00
Ryan Boren
46d96c7704 Bring out the pinking shears.
git-svn-id: https://develop.svn.wordpress.org/trunk@18254 602fd350-edb4-49c9-b593-d223f7449a82
2011-06-10 23:01:45 +00:00
Ryan Boren
d2af1830bc HTTP API PHP Doc Updates. Props sivel. fixes #17724
git-svn-id: https://develop.svn.wordpress.org/trunk@18185 602fd350-edb4-49c9-b593-d223f7449a82
2011-06-08 00:51:31 +00:00
Peter Westwood
93fe935843 Fix typos and inconsistencies in PHPdoc / function declarations. See #17414 props duck_
git-svn-id: https://develop.svn.wordpress.org/trunk@17925 602fd350-edb4-49c9-b593-d223f7449a82
2011-05-14 09:50:20 +00:00
Peter Westwood
c30cd0193d Introduce wp_http_supports as a much less hacky replacement for the http_transport_(get|post)_debug hooks that plugins could have
been using to detect if things like ssl requests were working.
See #17251 props mdawaffe


git-svn-id: https://develop.svn.wordpress.org/trunk@17914 602fd350-edb4-49c9-b593-d223f7449a82
2011-05-13 09:56:59 +00:00
Ryan Boren
9730cb8d15 Constructor cleanup. Props ocean90. fixes #16768
git-svn-id: https://develop.svn.wordpress.org/trunk@17771 602fd350-edb4-49c9-b593-d223f7449a82
2011-04-29 20:05:12 +00:00
Dion Hulse
0722876118 Allow the cURL transport to handle '0' response bodies. Fixes #17223
git-svn-id: https://develop.svn.wordpress.org/trunk@17692 602fd350-edb4-49c9-b593-d223f7449a82
2011-04-23 13:49:52 +00:00
Dion Hulse
cff5b0ac2a Remove support for the PHP HTTP Extension from WP_HTTP. The PHP HTTP Extension is a wrapper around libcurl and fopen() providing limited configuration and is supported on a minority of servers due to its non-default inclusion. Props sivel. Fixes @16978
git-svn-id: https://develop.svn.wordpress.org/trunk@17659 602fd350-edb4-49c9-b593-d223f7449a82
2011-04-19 04:22:59 +00:00
Dion Hulse
2b6b333f6b Verify certificate matches both the common name and the provided hostname. WP_HTTP_Curl requires CURLOPT_SSL_VERIFYHOST be either 2 or false. Props sivel. Fixes #16904
git-svn-id: https://develop.svn.wordpress.org/trunk@17616 602fd350-edb4-49c9-b593-d223f7449a82
2011-04-07 08:38:36 +00:00