Fix value of response when http response headers contains HTTP/1.1 100 Continue

This commit is contained in:
php-curl-class
2013-08-23 05:12:22 -07:00
parent 83c7fc76ab
commit 1f78da3cbf
+4 -5
View File
@@ -94,12 +94,11 @@ class Curl {
$this->request_headers = preg_split('/\r\n/', curl_getinfo($this->curl, CURLINFO_HEADER_OUT), NULL, PREG_SPLIT_NO_EMPTY);
$this->response_headers = '';
if (!(strpos($this->response, "\r\n\r\n") === FALSE)) {
$parts = explode("\r\n\r\n", $this->response, 3);
if (count($parts) === 3 && $parts['0'] === 'HTTP/1.1 100 Continue') {
array_shift($parts);
list($response_header, $this->response) = explode("\r\n\r\n", $this->response, 2);
if ($response_header === 'HTTP/1.1 100 Continue') {
list($response_header, $this->response) = explode("\r\n\r\n", $this->response, 2);
}
list($this->response_headers, $this->response) = $parts;
$this->response_headers = preg_split('/\r\n/', $this->response_headers, NULL, PREG_SPLIT_NO_EMPTY);
$this->response_headers = preg_split('/\r\n/', $response_header, NULL, PREG_SPLIT_NO_EMPTY);
}
$this->http_error_message = $this->error ? (isset($this->response_headers['0']) ? $this->response_headers['0'] : '') : '';