Changeset 22047
- Timestamp:
- 09/27/2012 06:54:17 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-http.php
r21996 r22047 170 170 $r['headers']['Accept-Encoding'] = WP_Http_Encoding::accept_encoding(); 171 171 172 if ( empty($r['body']) ) { 173 $r['body'] = null; 174 // Some servers fail when sending content without the content-length header being set. 175 // Also, to fix another bug, we only send when doing POST and PUT and the content-length 176 // header isn't already set. 177 if ( ($r['method'] == 'POST' || $r['method'] == 'PUT') && ! isset( $r['headers']['Content-Length'] ) ) 178 $r['headers']['Content-Length'] = 0; 179 } else { 172 if ( strlen( $r['body'] ) || 'POST' == $r['method'] || 'PUT' == $r['method'] ) { 180 173 if ( is_array( $r['body'] ) || is_object( $r['body'] ) ) { 181 174 $r['body'] = http_build_query( $r['body'], null, '&' ); 175 182 176 if ( ! isset( $r['headers']['Content-Type'] ) ) 183 177 $r['headers']['Content-Type'] = 'application/x-www-form-urlencoded; charset=' . get_option( 'blog_charset' ); 184 $r['headers']['Content-Length'] = strlen( $r['body'] );185 178 } 179 180 if ( '' === $r['body'] ) 181 $r['body'] = null; 186 182 187 183 if ( ! isset( $r['headers']['Content-Length'] ) && ! isset( $r['headers']['content-length'] ) ) … … 915 911 } 916 912 917 if ( ! empty($r['body'] ) )913 if ( ! is_null( $r['body'] ) ) 918 914 $arrContext['http']['content'] = $r['body']; 919 915 … … 1108 1104 default: 1109 1105 curl_setopt( $handle, CURLOPT_CUSTOMREQUEST, $r['method'] ); 1110 if ( ! empty( $r['body'] ) )1106 if ( ! is_null( $r['body'] ) ) 1111 1107 curl_setopt( $handle, CURLOPT_POSTFIELDS, $r['body'] ); 1112 1108 break;
Note: See TracChangeset
for help on using the changeset viewer.