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
6d999ab3
Commit
6d999ab3
authored
Jun 06, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Response WIP
parent
9b659346
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
3 deletions
+18
-3
Response.php
framework/yii/web/Response.php
+18
-3
No files found.
framework/yii/web/Response.php
View file @
6d999ab3
...
...
@@ -28,6 +28,21 @@ class Response extends \yii\base\Response
*/
public
$ajaxRedirectCode
=
278
;
private
$_headers
;
/**
* Returns the header collection.
* The header collection contains the currently registered HTTP headers.
* @return HeaderCollection the header collection
*/
public
function
getHeaders
()
{
if
(
$this
->
_headers
===
null
)
{
$this
->
_headers
=
new
HeaderCollection
;
}
return
$this
->
_headers
;
}
/**
* Sends a file to user.
* @param string $fileName file name
...
...
@@ -51,7 +66,7 @@ class Response extends \yii\base\Response
if
(
isset
(
$_SERVER
[
'HTTP_RANGE'
]))
{
// client sent us a multibyte range, can not hold this one for now
if
(
strpos
(
$_SERVER
[
'HTTP_RANGE'
],
','
)
!==
false
)
{
if
(
strpos
(
$_SERVER
[
'HTTP_RANGE'
],
','
)
!==
false
)
{
header
(
"Content-Range: bytes
$contentStart
-
$contentEnd
/
$fileSize
"
);
throw
new
HttpException
(
416
,
'Requested Range Not Satisfiable'
);
}
...
...
@@ -75,12 +90,12 @@ class Response extends \yii\base\Response
* http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
*/
// End bytes can not be larger than $end.
$contentEnd
=
(
$contentEnd
>
$fileSize
)
?
$fileSize
-
1
:
$contentEnd
;
$contentEnd
=
(
$contentEnd
>
$fileSize
)
?
$fileSize
-
1
:
$contentEnd
;
// Validate the requested range and return an error if it's not correct.
$wrongContentStart
=
(
$contentStart
>
$contentEnd
||
$contentStart
>
$fileSize
-
1
||
$contentStart
<
0
);
if
(
$wrongContentStart
)
{
if
(
$wrongContentStart
)
{
header
(
"Content-Range: bytes
$contentStart
-
$contentEnd
/
$fileSize
"
);
throw
new
HttpException
(
416
,
'Requested Range Not Satisfiable'
);
}
...
...
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