mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merge pull request #2212 from dhensby/patch-3
Adding test to prove issue with HTTP Header parsing in RestfulService
This commit is contained in:
commit
ed69a2bf82
@ -352,7 +352,7 @@ class RestfulService extends ViewableData {
|
|||||||
$match[1] = preg_replace_callback(
|
$match[1] = preg_replace_callback(
|
||||||
'/(?<=^|[\x09\x20\x2D])./',
|
'/(?<=^|[\x09\x20\x2D])./',
|
||||||
create_function('$matches', 'return strtoupper($matches[0]);'),
|
create_function('$matches', 'return strtoupper($matches[0]);'),
|
||||||
strtolower(trim($match[1]))
|
trim($match[1])
|
||||||
);
|
);
|
||||||
if( isset($headers[$match[1]]) ) {
|
if( isset($headers[$match[1]]) ) {
|
||||||
if (!is_array($headers[$match[1]])) {
|
if (!is_array($headers[$match[1]])) {
|
||||||
|
@ -172,12 +172,14 @@ class RestfulServiceTest extends SapphireTest {
|
|||||||
public function testHttpHeaderParseing() {
|
public function testHttpHeaderParseing() {
|
||||||
$headers = "content-type: text/html; charset=UTF-8\r\n".
|
$headers = "content-type: text/html; charset=UTF-8\r\n".
|
||||||
"Server: Funky/1.0\r\n".
|
"Server: Funky/1.0\r\n".
|
||||||
|
"X-BB-ExampleMANycaPS: test\r\n".
|
||||||
"Set-Cookie: foo=bar\r\n".
|
"Set-Cookie: foo=bar\r\n".
|
||||||
"Set-Cookie: baz=quux\r\n".
|
"Set-Cookie: baz=quux\r\n".
|
||||||
"Set-Cookie: bar=foo\r\n";
|
"Set-Cookie: bar=foo\r\n";
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'Content-Type' => 'text/html; charset=UTF-8',
|
'Content-Type' => 'text/html; charset=UTF-8',
|
||||||
'Server' => 'Funky/1.0',
|
'Server' => 'Funky/1.0',
|
||||||
|
'X-BB-ExampleMANycaPS' => 'test',
|
||||||
'Set-Cookie' => array(
|
'Set-Cookie' => array(
|
||||||
'foo=bar',
|
'foo=bar',
|
||||||
'baz=quux',
|
'baz=quux',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user