MDL-47198 filelib: fix curl handling headers with no value

This commit is contained in:
Davo Smith
2017-01-02 16:43:52 +01:00
committed by Eloy Lafuente (stronk7)
parent c5f11c0f3c
commit 31e4c05002
+3 -2
View File
@@ -3056,8 +3056,9 @@ class curl {
$this->responsefinished = false;
$this->response = array();
}
list($key, $value) = explode(" ", rtrim($header, "\r\n"), 2);
$key = rtrim($key, ':');
$parts = explode(" ", rtrim($header, "\r\n"), 2);
$key = rtrim($parts[0], ':');
$value = isset($parts[1]) ? $parts[1] : null;
if (!empty($this->response[$key])) {
if (is_array($this->response[$key])) {
$this->response[$key][] = $value;