Commit Graph

91 Commits

Author SHA1 Message Date
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
dd32 6f29700fdb 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: http://core.svn.wordpress.org/trunk@21230 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-08 05:16:26 +00:00
dd32 4db9e5c605 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: http://core.svn.wordpress.org/trunk@21227 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-07 12:06:09 +00:00
dd32 2005aed7e6 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: http://core.svn.wordpress.org/trunk@21226 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-07 04:23:49 +00:00
dd32 9ed35c4586 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: http://core.svn.wordpress.org/trunk@21225 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-07 02:27:13 +00:00
ryan 08d01e2950 Handle relative urls when processing redirects. Introduce WP_Http::make_absolute_url(). Props dd32. fixes #20434
git-svn-id: http://core.svn.wordpress.org/trunk@20767 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-10 21:32:02 +00:00
dd32 98e33b2f9b WP_HTTP: Curl: $theHeaders is an array, not an object, introduced in [20370]. Props kurtpayne. Fixes #20389 See #20219
git-svn-id: http://svn.automattic.com/wordpress/trunk@20399 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-07 07:16:30 +00:00
westi a1c575b671 Fix typo in [20372] - See #19922 props SergeyBiryukov.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20373 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-05 15:34:28 +00:00
westi 5b6c025cc3 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: http://svn.automattic.com/wordpress/trunk@20372 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-05 15:17:34 +00:00
dd32 c5b25fd6d0 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: http://svn.automattic.com/wordpress/trunk@20370 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-05 11:58:04 +00:00
dd32 f314fb3ea7 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: http://svn.automattic.com/wordpress/trunk@20208 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-18 05:00:05 +00:00
dd32 5bc2f55d50 WP_Http: cURL: Use the parsed args $r, rather than the raw $args. Mentioned in #20219
git-svn-id: http://svn.automattic.com/wordpress/trunk@20207 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-18 03:12:12 +00:00
dd32 ef6661a628 WP_HTTP: Send the body with custom method requests when using cURL. Fixes #18589
git-svn-id: http://svn.automattic.com/wordpress/trunk@20183 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-15 05:33:38 +00:00
dd32 3abb558ae8 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: http://svn.automattic.com/wordpress/trunk@19696 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-06 12:53:44 +00:00
ryan 83b131f8e3 User lowercase true, false, null instead of uppercase. Props c3mdigital, mfields. fixes #16302
git-svn-id: http://svn.automattic.com/wordpress/trunk@19687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-05 20:50:54 +00:00
ryan 616c35e71c One newline is enough.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19684 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-05 20:10:39 +00:00
ryan c924060858 Remove extraneuos newlines
git-svn-id: http://svn.automattic.com/wordpress/trunk@19623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-21 18:42:11 +00:00
ryan 07ff8b216b Use one space, not two, after trailing punctuation. fixes #19537
git-svn-id: http://svn.automattic.com/wordpress/trunk@19593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-13 23:45:31 +00:00
ryan 28b1b4763d Avoid E_STRICT notices. see #18975
git-svn-id: http://svn.automattic.com/wordpress/trunk@19094 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-31 19:38:46 +00:00
ryan 62afab8db3 Pinking shears
git-svn-id: http://svn.automattic.com/wordpress/trunk@19054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-24 19:13:23 +00:00
dd32 ee71b2eb88 Respect the Content-Type header developers pass to WP_HTTP. Fixes #18982
git-svn-id: http://svn.automattic.com/wordpress/trunk@19000 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-19 04:48:00 +00:00
dd32 f1ffd16440 Document the Magic numbering in WP_Http_Encoding::compatible_gzinflate(). Fixes #18273
git-svn-id: http://svn.automattic.com/wordpress/trunk@18806 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-29 02:10:35 +00:00
dd32 08bea55949 Pass $args and $url to the http_api_debug action to improve debugging. Props johnbillion. Fixes #18732
git-svn-id: http://svn.automattic.com/wordpress/trunk@18805 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-29 01:42:09 +00:00
dd32 f40bc45b6f Add inflation support for java.util.zip.Deflater in WP_Http_Encoding::compatible_gzinflate(). Fixes #18273
git-svn-id: http://svn.automattic.com/wordpress/trunk@18718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-19 14:43:43 +00:00
duck_ e4ed63fc6f Fix typos in documentation (wp-includes/[a-h]). See #18560.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-03 16:02:41 +00:00
ryan 28b241df2b Empty headers instance var instead of unsetting to avoid warning. Props chrisbliss18. fixes #18157
git-svn-id: http://svn.automattic.com/wordpress/trunk@18457 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-07-21 21:44:35 +00:00
ryan daa14c36f9 Bring out the pinking shears.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18254 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-10 23:01:45 +00:00
ryan a98d5a605c HTTP API PHP Doc Updates. Props sivel. fixes #17724
git-svn-id: http://svn.automattic.com/wordpress/trunk@18185 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-08 00:51:31 +00:00
westi 65e341d0cb Fix typos and inconsistencies in PHPdoc / function declarations. See #17414 props duck_
git-svn-id: http://svn.automattic.com/wordpress/trunk@17925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-05-14 09:50:20 +00:00
westi 81cd0218ec 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: http://svn.automattic.com/wordpress/trunk@17914 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-05-13 09:56:59 +00:00
ryan 04487fc268 Constructor cleanup. Props ocean90. fixes #16768
git-svn-id: http://svn.automattic.com/wordpress/trunk@17771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-29 20:05:12 +00:00
dd32 ad5f5db861 Allow the cURL transport to handle '0' response bodies. Fixes #17223
git-svn-id: http://svn.automattic.com/wordpress/trunk@17692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-23 13:49:52 +00:00
dd32 e2b914fbad 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: http://svn.automattic.com/wordpress/trunk@17659 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-19 04:22:59 +00:00
dd32 c1e70ae5e6 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: http://svn.automattic.com/wordpress/trunk@17616 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-07 08:38:36 +00:00