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
4dabe605
Commit
4dabe605
authored
Jan 22, 2014
by
Vladimir Zbrailov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added use http_get_request_headers and use getHeaders method in Gii module
parent
a42710ad
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
+15
-8
RequestPanel.php
extensions/debug/panels/RequestPanel.php
+7
-5
Request.php
framework/web/Request.php
+8
-3
No files found.
extensions/debug/panels/RequestPanel.php
View file @
4dabe605
...
...
@@ -36,13 +36,15 @@ class RequestPanel extends Panel
public
function
save
()
{
if
(
function_exists
(
'apache_request_headers'
))
{
$requestHeaders
=
apache_request_headers
();
}
elseif
(
function_exists
(
'http_get_request_headers'
)
)
{
$requestHeaders
=
http_get_request_headers
(
);
$headers
=
Yii
::
$app
->
getRequest
()
->
getHeaders
();
foreach
(
$headers
as
$name
=>
$value
)
{
if
(
is_array
(
$value
)
&&
count
(
$value
)
==
1
)
{
$requestHeaders
[
$name
]
=
current
(
$value
);
}
else
{
$requestHeaders
=
[]
;
$requestHeaders
[
$name
]
=
$value
;
}
}
$responseHeaders
=
[];
foreach
(
headers_list
()
as
$header
)
{
if
((
$pos
=
strpos
(
$header
,
':'
))
!==
false
)
{
...
...
framework/web/Request.php
View file @
4dabe605
...
...
@@ -182,11 +182,11 @@ class Request extends \yii\base\Request
{
if
(
$this
->
_headers
===
null
)
{
$this
->
_headers
=
new
HeaderCollection
;
$headers
=
[];
if
(
function_exists
(
'getallheaders'
))
{
$headers
=
getallheaders
();
foreach
(
$headers
as
$name
=>
$value
)
{
$this
->
_headers
->
add
(
$name
,
$value
);
}
}
elseif
(
function_exists
(
'http_get_request_headers'
))
{
$headers
=
http_get_request_headers
();
}
else
{
foreach
(
$_SERVER
as
$name
=>
$value
)
{
if
(
substr
(
$name
,
0
,
5
)
==
'HTTP_'
)
{
...
...
@@ -194,8 +194,13 @@ class Request extends \yii\base\Request
$this
->
_headers
->
add
(
$name
,
$value
);
}
}
return
$this
->
_headers
;
}
foreach
(
$headers
as
$name
=>
$value
)
{
$this
->
_headers
->
add
(
$name
,
$value
);
}
}
return
$this
->
_headers
;
}
...
...
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