Ticket #26726: 26726.diff
| File 26726.diff, 1.5 KB (added by , 12 years ago) |
|---|
-
wp-includes/class-http.php
1087 1087 private $max_body_length = false; 1088 1088 1089 1089 /** 1090 * The total bytes written in the current request. 1091 * 1092 * @since 3.9.0 1093 * @access prviate 1094 * @var int 1095 */ 1096 private $bytes_written_total = 0; 1097 1098 /** 1090 1099 * The file resource used for streaming to file. 1091 1100 * 1092 1101 * @since 3.6.0 … … 1252 1261 1253 1262 $this->headers = ''; 1254 1263 $this->body = ''; 1264 $this->bytes_written_total = 0; 1255 1265 1256 1266 $curl_error = curl_errno( $handle ); 1257 1267 … … 1327 1337 private function stream_body( $handle, $data ) { 1328 1338 $data_length = strlen( $data ); 1329 1339 1330 if ( $this->max_body_length && ( strlen( $this->body )+ $data_length ) > $this->max_body_length )1331 $data = substr( $data, 0, ( $this->max_body_length - $ data_length ) );1340 if ( $this->max_body_length && ( $this->bytes_written_total + $data_length ) > $this->max_body_length ) 1341 $data = substr( $data, 0, ( $this->max_body_length - $this->bytes_written_total - $data_length ) ); 1332 1342 1333 1343 if ( $this->stream_handle ) { 1334 1344 $bytes_written = fwrite( $this->stream_handle, $data ); … … 1337 1347 $bytes_written = $data_length; 1338 1348 } 1339 1349 1350 $this->bytes_written_total .= $bytes_written; 1351 1340 1352 // Upon event of this function returning less than strlen( $data ) curl will error with CURLE_WRITE_ERROR 1341 1353 return $bytes_written; 1342 1354 }