Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
53647d8b
Commit
53647d8b
authored
Jan 22, 2014
by
Vladimir Zbrailov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added ability to get incoming headers
parent
4fe0eeb1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
Request.php
framework/web/Request.php
+30
-0
No files found.
framework/CHANGELOG.md
View file @
53647d8b
...
@@ -93,6 +93,7 @@ Yii Framework 2 Change Log
...
@@ -93,6 +93,7 @@ Yii Framework 2 Change Log
-
Enh #1839: Added support for getting file extension and basename from uploaded file (anfrantic)
-
Enh #1839: Added support for getting file extension and basename from uploaded file (anfrantic)
-
Enh: yii
\c
odeception
\T
estCase now supports loading and using fixtures via Yii fixture framework (qiangxue)
-
Enh: yii
\c
odeception
\T
estCase now supports loading and using fixtures via Yii fixture framework (qiangxue)
-
Enh: Added support to parse json request data to Request::getRestParams() (cebe)
-
Enh: Added support to parse json request data to Request::getRestParams() (cebe)
-
Enh: Added ability to get incoming headers (dizews)
-
Chg #1519:
`yii\web\User::loginRequired()`
now returns the
`Response`
object instead of exiting the application (qiangxue)
-
Chg #1519:
`yii\web\User::loginRequired()`
now returns the
`Response`
object instead of exiting the application (qiangxue)
-
Chg #1586:
`QueryBuilder::buildLikeCondition()`
will now escape special characters and use percentage characters by default (qiangxue)
-
Chg #1586:
`QueryBuilder::buildLikeCondition()`
will now escape special characters and use percentage characters by default (qiangxue)
-
Chg #1610:
`Html::activeCheckboxList()`
and
`Html::activeRadioList()`
will submit an empty string if no checkbox/radio is selected (qiangxue)
-
Chg #1610:
`Html::activeCheckboxList()`
and
`Html::activeRadioList()`
will submit an empty string if no checkbox/radio is selected (qiangxue)
...
...
framework/web/Request.php
View file @
53647d8b
...
@@ -151,6 +151,10 @@ class Request extends \yii\base\Request
...
@@ -151,6 +151,10 @@ class Request extends \yii\base\Request
private
$_cookies
;
private
$_cookies
;
/**
* @var array the headers in this collection (indexed by the header names)
*/
private
$_headers
;
/**
/**
* Resolves the current request into a route and the associated parameters.
* Resolves the current request into a route and the associated parameters.
...
@@ -170,6 +174,32 @@ class Request extends \yii\base\Request
...
@@ -170,6 +174,32 @@ class Request extends \yii\base\Request
}
}
/**
/**
* Returns the header collection.
* The header collection contains incoming HTTP headers.
* @return HeaderCollection the header collection
*/
public
function
getHeaders
()
{
if
(
$this
->
_headers
===
null
)
{
$this
->
_headers
=
new
HeaderCollection
;
if
(
function_exists
(
'getallheaders'
))
{
$headers
=
getallheaders
();
foreach
(
$headers
as
$name
=>
$value
)
{
$this
->
_headers
->
add
(
$name
,
$value
);
}
}
else
{
foreach
(
$_SERVER
as
$name
=>
$value
)
{
if
(
substr
(
$name
,
0
,
5
)
==
'HTTP_'
)
{
$name
=
str_replace
(
' '
,
'-'
,
ucwords
(
strtolower
(
str_replace
(
'_'
,
' '
,
substr
(
$name
,
5
)))));
$this
->
_headers
->
add
(
$name
,
$value
);
}
}
}
}
return
$this
->
_headers
;
}
/**
* Returns the method of the current request (e.g. GET, POST, HEAD, PUT, PATCH, DELETE).
* Returns the method of the current request (e.g. GET, POST, HEAD, PUT, PATCH, DELETE).
* @return string request method, such as GET, POST, HEAD, PUT, PATCH, DELETE.
* @return string request method, such as GET, POST, HEAD, PUT, PATCH, DELETE.
* The value returned is turned into upper case.
* The value returned is turned into upper case.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment