diff options
author | Dries Buytaert <dries@buytaert.net> | 2006-02-23 15:19:10 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2006-02-23 15:19:10 +0000 |
commit | 18aaf1120d9b1a94accc8b8329d8d97284b6931d (patch) | |
tree | 62ef7b53a2fe5ca61d02528fdcad0c53ab4c68a2 | |
parent | 9e7ecfa1f9617d92206adda0d9124c512d821b2a (diff) | |
download | brdo-18aaf1120d9b1a94accc8b8329d8d97284b6931d.tar.gz brdo-18aaf1120d9b1a94accc8b8329d8d97284b6931d.tar.bz2 |
- Patch #50912 by eberts: HTTP request overrides headers and data on redirect.
-rw-r--r-- | includes/common.inc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/includes/common.inc b/includes/common.inc index cd3bb6aae..f99bda8b0 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -366,20 +366,20 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data = // Fetch response. $response = ''; - while (!feof($fp) && $data = fread($fp, 1024)) { - $response .= $data; + while (!feof($fp) && $chunk = fread($fp, 1024)) { + $response .= $chunk; } fclose($fp); // Parse response. - list($headers, $result->data) = explode("\r\n\r\n", $response, 2); - $headers = preg_split("/\r\n|\n|\r/", $headers); + list($split, $result->data) = explode("\r\n\r\n", $response, 2); + $split = preg_split("/\r\n|\n|\r/", $split); - list($protocol, $code, $text) = explode(' ', trim(array_shift($headers)), 3); + list($protocol, $code, $text) = explode(' ', trim(array_shift($split)), 3); $result->headers = array(); // Parse headers. - while ($line = trim(array_shift($headers))) { + while ($line = trim(array_shift($split))) { list($header, $value) = explode(':', $line, 2); if (isset($result->headers[$header]) && $header == 'Set-Cookie') { // RFC 2109: the Set-Cookie response header comprises the token Set- @@ -1337,4 +1337,4 @@ function page_set_cache() { } } } -} +}
\ No newline at end of file |