-
Notifications
You must be signed in to change notification settings - Fork 17
IBX-11131: Streaming files fix for apache + php-fpm #695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.6
Are you sure you want to change the base?
Conversation
Steveb-p
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that this is expected behavior based on what I've found on the web.
There are three relevant statuses, when working with range requests:
A successful range request elicits a 206 Partial Content status from the server.
A range request that is out of bounds will result in a 416 Requested Range Not Satisfiable status, meaning that none of the range values overlap the extent of the resource. For example, the first-byte-pos of every range might be greater than the resource length.
If range requests are not supported, an 200 OK status is sent back and the entire response body is transmitted.
So I agree, even for full-length response including whole file, if the client asks for a range, we should respond with 206 unless going out of bounds.
| $this->maxlen = $end - $start + 1; | ||
| $this->offset = $start; | ||
|
|
||
| $this->setStatusCode(206); // HTTP_PARTIAL_CONTENT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| $this->setStatusCode(206); // HTTP_PARTIAL_CONTENT | |
| $this->setStatusCode(Response::HTTP_PARTIAL_CONTENT); |
|
|
||
| if ($start <= $end) { | ||
| if ($start < 0 || $end > $fileSize - 1) { | ||
| $this->setStatusCode(416); // HTTP_REQUESTED_RANGE_NOT_SATISFIABLE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and while we are close and at it:
| $this->setStatusCode(416); // HTTP_REQUESTED_RANGE_NOT_SATISFIABLE | |
| $this->setStatusCode(Response::HTTP_REQUESTED_RANGE_NOT_SATISFIABLE); |
|



Description:
Apache using php-fpm is causing issues when streaming content on chromium based browsers.
I've changed the response to 206 even when providing full files.