Ticket #8620: http.2.diff
File http.2.diff, 2.2 KB (added by , 14 years ago) |
---|
-
wp-includes/http.php
1176 1176 * @return array The headers of the response. Empty array if incorrect parameter given. 1177 1177 */ 1178 1178 function wp_remote_retrieve_headers(&$response) { 1179 if ( ! isset($response['headers']) || ! is_array($response['headers'])) 1179 if ( is_wp_error($response) ) 1180 return $response; 1181 1182 if ( ! isset($response['headers']) || ! is_array($response['headers']) ) 1180 1183 return array(); 1181 1184 1182 1185 return $response['headers']; … … 1192 1195 * @return array The header value. Empty string on if incorrect parameter given. 1193 1196 */ 1194 1197 function wp_remote_retrieve_header(&$response, $header) { 1195 if ( ! isset($response['headers']) || ! is_array($response['headers'])) 1198 if ( is_wp_error($response) ) 1199 return $response; 1200 1201 if ( ! isset($response['headers']) || ! is_array($response['headers']) ) 1196 1202 return ''; 1197 1203 1198 1204 if ( array_key_exists($header, $response['headers']) ) … … 1212 1218 * @return array The keys 'code' and 'message' give information on the response. 1213 1219 */ 1214 1220 function wp_remote_retrieve_response_code(&$response) { 1215 if ( ! isset($response['response']) || ! is_array($response['response'])) 1221 if ( is_wp_error($response) ) 1222 return $response; 1223 1224 if ( ! isset($response['response']) || ! is_array($response['response']) ) 1216 1225 return ''; 1217 1226 1218 1227 return $response['response']['code']; … … 1229 1238 * @return array The keys 'code' and 'message' give information on the response. 1230 1239 */ 1231 1240 function wp_remote_retrieve_response_message(&$response) { 1232 if ( ! isset($response['response']) || ! is_array($response['response'])) 1241 if ( is_wp_error($response) ) 1242 return $response; 1243 1244 if ( ! isset($response['response']) || ! is_array($response['response']) ) 1233 1245 return ''; 1234 1246 1235 1247 return $response['response']['message']; … … 1244 1256 * @return string The body of the response. Empty string if no body or incorrect parameter given. 1245 1257 */ 1246 1258 function wp_remote_retrieve_body(&$response) { 1259 if ( is_wp_error($response) ) 1260 return $response; 1261 1247 1262 if ( ! isset($response['body']) ) 1248 1263 return ''; 1249 1264