Ticket #8618: 8618.diff
File 8618.diff, 7.7 KB (added by , 16 years ago) |
---|
-
http.php
8 8 * 9 9 * @package WordPress 10 10 * @subpackage HTTP 11 * @since 2.7 11 * @since 2.7.0 12 12 * @author Jacob Santos <wordpress@santosj.name> 13 13 */ 14 14 … … 32 32 * 33 33 * @package WordPress 34 34 * @subpackage HTTP 35 * @since 2.7 35 * @since 2.7.0 36 36 */ 37 37 class WP_Http { 38 38 39 39 /** 40 40 * PHP4 style Constructor - Calls PHP5 Style Constructor 41 41 * 42 * @since 2.7 42 * @since 2.7.0 43 43 * @return WP_Http 44 44 */ 45 45 function WP_Http() { … … 55 55 * The transport are setup to save time. This should only be called once, so 56 56 * the overhead should be fine. 57 57 * 58 * @since 2.7 58 * @since 2.7.0 59 59 * @return WP_Http 60 60 */ 61 61 function __construct() { … … 81 81 * period of time, or established connection failed because connected host 82 82 * has failed to respond." 83 83 * 84 * @since 2.7 84 * @since 2.7.0 85 85 * @access private 86 86 * 87 87 * @param array $args Request args, default us an empty array … … 129 129 * to send content, but the streams transport can. This is a limitation that 130 130 * is addressed here, by just not including that transport. 131 131 * 132 * @since 2.7 132 * @since 2.7.0 133 133 * @access private 134 134 * 135 135 * @param array $args Request args, default us an empty array … … 201 201 * continue going after making the request. 202 202 * 203 203 * @access public 204 * @since 2.7 204 * @since 2.7.0 205 205 * 206 206 * @param string $url URI resource. 207 207 * @param str|array $args Optional. Override the defaults. … … 273 273 * Used for sending data that is expected to be in the body. 274 274 * 275 275 * @access public 276 * @since 2.7 276 * @since 2.7.0 277 277 * 278 278 * @param string $url URI resource. 279 279 * @param str|array $args Optional. Override the defaults. … … 291 291 * Used for sending data that is expected to be in the body. 292 292 * 293 293 * @access public 294 * @since 2.7 294 * @since 2.7.0 295 295 * 296 296 * @param string $url URI resource. 297 297 * @param str|array $args Optional. Override the defaults. … … 309 309 * Used for sending data that is expected to be in the body. 310 310 * 311 311 * @access public 312 * @since 2.7 312 * @since 2.7.0 313 313 * 314 314 * @param string $url URI resource. 315 315 * @param str|array $args Optional. Override the defaults. … … 326 326 * 327 327 * @access public 328 328 * @static 329 * @since 2.7 329 * @since 2.7.0 330 330 * 331 331 * @param string $strResponse The full response string 332 332 * @return array Array with 'headers' and 'body' keys. … … 345 345 * 346 346 * @access public 347 347 * @static 348 * @since 2.7 348 * @since 2.7.0 349 349 * 350 350 * @param string|array $headers 351 351 * @return array Processed string headers … … 386 386 * 387 387 * @todo Add support for footer chunked headers. 388 388 * @access public 389 * @since 2.7 389 * @since 2.7.0 390 390 * @static 391 391 * 392 392 * @param string $body Body content … … 408 408 409 409 if ( $hasChunk ) { 410 410 if ( empty($match[1]) ) { 411 return new WP_Error('http_chunked_decode', __('Does not appear to be chunked encoded or body is malformed.') );411 return $body; 412 412 } 413 413 414 414 $length = hexdec( $match[1] ); … … 425 425 break; 426 426 } 427 427 } else { 428 return new WP_Error('http_chunked_decode', __('Does not appear to be chunked encoded or body is malformed.') );428 return $body; 429 429 } 430 } while ( false === $done );430 } while ( true === $done ); 431 431 } 432 432 } 433 433 … … 439 439 * 440 440 * @package WordPress 441 441 * @subpackage HTTP 442 * @since 2.7 442 * @since 2.7.0 443 443 */ 444 444 class WP_Http_Fsockopen { 445 445 /** … … 583 583 /** 584 584 * Whether this class can be used for retrieving an URL. 585 585 * 586 * @since 2.7 586 * @since 2.7.0 587 587 * @static 588 588 * @return boolean False means this class can not be used, true means it can. 589 589 */ … … 607 607 * 608 608 * @package WordPress 609 609 * @subpackage HTTP 610 * @since 2.7 610 * @since 2.7.0 611 611 */ 612 612 class WP_Http_Fopen { 613 613 /** … … 621 621 * @see WP_Http::retrieve For default options descriptions. 622 622 * 623 623 * @access public 624 * @since 2.7 624 * @since 2.7.0 625 625 * 626 626 * @param string $url URI resource. 627 627 * @param str|array $args Optional. Override the defaults. … … 693 693 /** 694 694 * Whether this class can be used for retrieving an URL. 695 695 * 696 * @since 2.7.0 696 697 * @static 697 698 * @return boolean False means this class can not be used, true means it can. 698 699 */ … … 714 715 * 715 716 * @package WordPress 716 717 * @subpackage HTTP 717 * @since 2.7 718 * @since 2.7.0 718 719 */ 719 720 class WP_Http_Streams { 720 721 /** 721 722 * Send a HTTP request to a URI using streams with fopen(). 722 723 * 723 724 * @access public 724 * @since 2.7 725 * @since 2.7.0 725 726 * 726 727 * @param string $url 727 728 * @param str|array $args Optional. Override the defaults. … … 817 818 * 818 819 * @static 819 820 * @access public 820 * @since 2.7 821 * @since 2.7.0 821 822 * 822 823 * @return boolean False means this class can not be used, true means it can. 823 824 */ … … 842 843 * 843 844 * @package WordPress 844 845 * @subpackage HTTP 845 * @since 2.7 846 * @since 2.7.0 846 847 */ 847 848 class WP_Http_ExtHTTP { 848 849 /** … … 932 933 * Whether this class can be used for retrieving an URL. 933 934 * 934 935 * @static 935 * @since 2.7 936 * @since 2.7.0 936 937 * 937 938 * @return boolean False means this class can not be used, true means it can. 938 939 */ … … 958 959 * Send a HTTP request to a URI using cURL extension. 959 960 * 960 961 * @access public 961 * @since 2.7 962 * @since 2.7.0 962 963 * 963 964 * @param string $url 964 965 * @param str|array $args Optional. Override the defaults. … … 1057 1058 * Whether this class can be used for retrieving an URL. 1058 1059 * 1059 1060 * @static 1060 * @since 2.7 1061 * @since 2.7.0 1061 1062 * 1062 1063 * @return boolean False means this class can not be used, true means it can. 1063 1064 */ … … 1072 1073 /** 1073 1074 * Returns the initialized WP_Http Object 1074 1075 * 1075 * @since 2.7 1076 * @since 2.7.0 1076 1077 * @access private 1077 1078 * 1078 1079 * @return WP_Http HTTP Transport object. … … 1123 1124 * 1124 1125 * @see wp_remote_request() For more information on the response array format. 1125 1126 * 1126 * @since 2.7 1127 * @since 2.7.0 1127 1128 * 1128 1129 * @param string $url Site URL to retrieve. 1129 1130 * @param array $args Optional. Override the defaults. … … 1140 1141 * 1141 1142 * @see wp_remote_request() For more information on the response array format. 1142 1143 * 1143 * @since 2.7 1144 * @since 2.7.0 1144 1145 * 1145 1146 * @param string $url Site URL to retrieve. 1146 1147 * @param array $args Optional. Override the defaults. … … 1156 1157 * 1157 1158 * @see wp_remote_request() For more information on the response array format. 1158 1159 * 1159 * @since 2.7 1160 * @since 2.7.0 1160 1161 * 1161 1162 * @param string $url Site URL to retrieve. 1162 1163 * @param array $args Optional. Override the defaults. … … 1170 1171 /** 1171 1172 * Retrieve only the headers from the raw response. 1172 1173 * 1173 * @since 2.7 1174 * @since 2.7.0 1174 1175 * 1175 1176 * @param array $response HTTP response. 1176 1177 * @return array The headers of the response. Empty array if incorrect parameter given. … … 1185 1186 /** 1186 1187 * Retrieve a single header by name from the raw response. 1187 1188 * 1188 * @since 2.7 1189 * @since 2.7.0 1189 1190 * 1190 1191 * @param array $response 1191 1192 * @param string $header Header name to retrieve value from. … … 1206 1207 * 1207 1208 * Will return an empty array if incorrect parameter value is given. 1208 1209 * 1209 * @since 2.7 1210 * @since 2.7.0 1210 1211 * 1211 1212 * @param array $response HTTP response. 1212 1213 * @return array The keys 'code' and 'message' give information on the response. … … 1223 1224 * 1224 1225 * Will return an empty array if incorrect parameter value is given. 1225 1226 * 1226 * @since 2.7 1227 * @since 2.7.0 1227 1228 * 1228 1229 * @param array $response HTTP response. 1229 1230 * @return array The keys 'code' and 'message' give information on the response. … … 1238 1239 /** 1239 1240 * Retrieve only the body from the raw response. 1240 1241 * 1241 * @since 2.7 1242 * @since 2.7.0 1242 1243 * 1243 1244 * @param array $response HTTP response. 1244 1245 * @return string The body of the response. Empty string if no body or incorrect parameter given.