Changeset 11937
- Timestamp:
- 09/15/2009 03:57:49 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/http.php
r11932 r11937 209 209 * @access public 210 210 * @since 2.7.0 211 * @todo Refactor this code. The code in this method extends the scope of its original purpose 212 * and should be refactored to allow for cleaner abstraction and reduce duplication of the 213 * code. One suggestion is to create a class specifically for the arguments, however 214 * preliminary refactoring to this affect has affect more than just the scope of the 215 * arguments. Something to ponder at least. 211 216 * 212 217 * @param string $url URI resource. … … 278 283 $r['headers']['Accept-Encoding'] = WP_Http_Encoding::accept_encoding(); 279 284 280 if ( is_null($r['body']) ) { 281 // Some servers fail when sending content without the content-length 282 // header being set. 283 $r['headers']['Content-Length'] = null; 285 if ( empty($r['body']) ) { 286 // Some servers fail when sending content without the content-length header being set. 287 // Also, to fix another bug, we only send when doing POST and PUT and the content-length 288 // header isn't already set. 289 if( ($r['method'] == 'POST' || $r['method'] == 'PUT') && ! isset($r['headers']['Content-Length']) ) 290 $r['headers']['Content-Length'] = 0; 291 292 // The method is ambiguous, because we aren't talking about HTTP methods, the "get" in 293 // this case is simply that we aren't sending any bodies and to get the transports that 294 // don't support sending bodies along with those which do. 284 295 $transports = WP_Http::_getTransport($r); 285 296 } else { … … 296 307 $r['headers']['Content-Length'] = strlen($r['body']); 297 308 309 // The method is ambiguous, because we aren't talking about HTTP methods, the "post" in 310 // this case is simply that we are sending HTTP body and to get the transports that do 311 // support sending the body. Not all do, depending on the limitations of the PHP core 312 // limitations. 298 313 $transports = WP_Http::_postTransport($r); 299 314 }
Note: See TracChangeset
for help on using the changeset viewer.