-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Fix range result pattern match bug #6327
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
Fix range result pattern match bug #6327
Conversation
|
@jtescher there is a test failing: https://travis-ci.org/playframework/playframework/jobs/145093973#L1079 You can run these tests in isolation by executing the following command inside sbt "~ test-only play.api.mvc.Range*" |
207cb84 to
e676e73
Compare
|
@marcospereira the tests should now be passing. I'm not entirely sure what the behavior should be for requesting bytes from streams that do not have a fixed entity length. Current behavior in RangeSet#first seems to be that it will accept the first byte, but ignore the last byte. So if you pass |
e676e73 to
3248e26
Compare
|
@marcospereira thoughts? This PR fixes the matching bug currently. The other issues are greater questions that could probably be addressed in another PR if required. |
|
@jtescher sorry for the delay. I did not had time to look at this PR but I will review it again today at night and let you know if I have any other concerns. |
|
Ok great, thanks a lot |
According to RFC 7233, it should use the last-byte-pos or the remainder of the entity:
This is not the current behavior, but it could be corrected in another PR. This PR can also be backported to 2.5.x branch. @jtescher thank you and sorry about the delay. |
|
Backport to 2.5.x: e340beb |
|
Great, thanks for the review and quick responses! |
Pull Request Checklist
Purpose
Currently the regular expression in https://github.com/playframework/playframework/blob/2.5.4/framework/src/play/src/main/scala/play/api/mvc/RangeResult.scala#L268-L271 will not match expected range header values.
E.g.
Will incorrectly fall through to
case _ => ...even thoughheader.matches(WithoutEntityLengthRangeSetPattern.regex)istrueWe need to add a parameter or
_to the case statement as I have in this PR to allow it to successfully match.Will match correctly.