Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb7a24e2

Browse files
committed
[HttpFoundation] Add OTIONS and TRACE to the list of safe methods
1 parentb7ed32a commitb7a24e2

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

‎src/Symfony/Component/HttpFoundation/Request.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,7 @@ public function isMethod($method)
14701470
*/
14711471
publicfunctionisMethodSafe()
14721472
{
1473-
returnin_array($this->getMethod(),array('GET','HEAD'));
1473+
returnin_array($this->getMethod(),array('GET','HEAD','OPTIONS','TRACE'));
14741474
}
14751475

14761476
/**

‎src/Symfony/Component/HttpFoundation/Tests/RequestTest.php‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,6 +1912,32 @@ public function getLongHostNames()
19121912
array(str_repeat(':',101)),
19131913
);
19141914
}
1915+
1916+
/**
1917+
* @dataProvider methodProvider
1918+
*/
1919+
publicfunctiontestMethodSafe()
1920+
{
1921+
$request =newRequest();
1922+
$request->setMethod(Request::METHOD_GET);
1923+
$this->assertTrue($request->isMethodSafe());
1924+
}
1925+
1926+
publicfunctionmethodProvider()
1927+
{
1928+
returnarray(
1929+
array(Request::METHOD_HEAD,true),
1930+
array(Request::METHOD_GET,true),
1931+
array(Request::METHOD_POST,false),
1932+
array(Request::METHOD_PUT,false),
1933+
array(Request::METHOD_PATCH,false),
1934+
array(Request::METHOD_DELETE,false),
1935+
array(Request::METHOD_PURGE,false),
1936+
array(Request::METHOD_OPTIONS,true),
1937+
array(Request::METHOD_TRACE,true),
1938+
array(Request::METHOD_CONNECT,false),
1939+
);
1940+
}
19151941
}
19161942

19171943
class RequestContentProxyextends Request

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp