[HttpFoundation] added missing CONTENT_TYPE and CONTENT_LENGTH to the Request headers (these two headers are not prefixes with HTTP_ -- as per the CGI/1.1 spec, closes #1234)
This commit is contained in:
parent
188e74273a
commit
f16e206cd7
@ -308,7 +308,12 @@ class Request
|
|||||||
// FIXME: populate $_FILES
|
// FIXME: populate $_FILES
|
||||||
|
|
||||||
foreach ($this->headers->all() as $key => $value) {
|
foreach ($this->headers->all() as $key => $value) {
|
||||||
$_SERVER['HTTP_'.strtoupper(str_replace('-', '_', $key))] = implode(', ', $value);
|
$key = strtoupper(str_replace('-', '_', $key));
|
||||||
|
if (in_array($key, array('CONTENT_TYPE', 'CONTENT_LENGTH'))) {
|
||||||
|
$_SERVER[$key] = implode(', ', $value);
|
||||||
|
} else {
|
||||||
|
$_SERVER['HTTP_'.$key] = implode(', ', $value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: should read variables_order and request_order
|
// FIXME: should read variables_order and request_order
|
||||||
|
@ -28,6 +28,13 @@ class ServerBag extends ParameterBag
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CONTENT_TYPE and CONTENT_LENGTH are not prefixed with HTTP_
|
||||||
|
foreach (array('CONTENT_TYPE', 'CONTENT_LENGTH') as $key) {
|
||||||
|
if (isset($this->parameters[$key])) {
|
||||||
|
$headers[$key] = $this->parameters[$key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $headers;
|
return $headers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user