diff options
| author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-10-19 08:29:36 +0000 |
|---|---|---|
| committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-10-19 08:29:36 +0000 |
| commit | 1a5bc7eb75f3ba36c572f72eabeb4c10e1573b63 (patch) | |
| tree | e2e9feeec033008af61eddc8494cb466bf217e9d /wp-inst/wp-includes/functions.php | |
| parent | 5706c01ed558781a96c746a7e788bf7bbff85115 (diff) | |
WP Merge
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@405 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst/wp-includes/functions.php')
| -rw-r--r-- | wp-inst/wp-includes/functions.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/wp-inst/wp-includes/functions.php b/wp-inst/wp-includes/functions.php index cd126d1..b9a046b 100644 --- a/wp-inst/wp-includes/functions.php +++ b/wp-inst/wp-includes/functions.php @@ -927,9 +927,13 @@ function do_enclose( $content, $post_ID ) { endforeach; } -function wp_get_http_headers( $url ) { +function wp_get_http_headers( $url, $red = 1 ) { global $wp_version; @set_time_limit( 60 ); + + if ( $red > 5 ) + return false; + $parts = parse_url( $url ); $file = $parts['path'] . ($parts['query'] ? '?'.$parts['query'] : ''); $host = $parts['host']; @@ -954,6 +958,13 @@ function wp_get_http_headers( $url ) { $headers["$key"] = $matches[2][$i]; } + $code = preg_replace('/.*?(\d{3}).*/i', '$1', $response); + + $headers['status_code'] = $code; + + if ( '302' == $code || '301' == $code ) + return wp_get_http_headers( $url, ++$red ); + preg_match('/.*([0-9]{3}).*/', $response, $return); $headers['response'] = $return[1]; // HTTP response code eg 204, 200, 404 return $headers; |
