Changeset 31290
- Timestamp:
- 01/29/2015 03:57:42 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-http.php
r31126 r31290 1521 1521 // If an error occurred, or, no response. 1522 1522 if ( $curl_error || ( 0 == strlen( $theBody ) && empty( $theHeaders['headers'] ) ) ) { 1523 if ( CURLE_WRITE_ERROR /* 23 */ == $curl_error && $r['stream']) {1523 if ( CURLE_WRITE_ERROR /* 23 */ == $curl_error ) { 1524 1524 if ( ! $this->max_body_length || $this->max_body_length != $bytes_written_total ) { 1525 fclose( $this->stream_handle ); 1526 return new WP_Error( 'http_request_failed', __( 'Failed to write request to temporary file.' ) ); 1525 if ( $r['stream'] ) { 1526 curl_close( $handle ); 1527 fclose( $this->stream_handle ); 1528 return new WP_Error( 'http_request_failed', __( 'Failed to write request to temporary file.' ) ); 1529 } else { 1530 curl_close( $handle ); 1531 return new WP_Error( 'http_request_failed', curl_error( $handle ) ); 1532 } 1527 1533 } 1528 1534 } else { -
trunk/tests/phpunit/tests/http/base.php
r29968 r31290 217 217 218 218 /** 219 * Tests Limiting the response size when returning strings 220 * 221 * @ticket 31172 222 */ 223 function test_request_limited_size() { 224 // we'll test against a file in the unit test data 225 $url = 'http://develop.svn.wordpress.org/trunk/tests/phpunit/data/images/2004-07-22-DSC_0007.jpg'; 226 $size = 10000; 227 228 $res = wp_remote_request( $url, array( 'timeout' => 30, 'limit_response_size' => $size ) ); 229 230 $this->assertFalse( is_wp_error( $res ) ); 231 $this->assertEquals( $size, strlen( $res['body'] ) ); 232 } 233 234 /** 219 235 * Test POST redirection methods 220 236 *
Note: See TracChangeset
for help on using the changeset viewer.