Skip to content
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

Ku range fix #17

Merged
merged 3 commits into from
Jan 16, 2015
Merged

Ku range fix #17

merged 3 commits into from
Jan 16, 2015

Conversation

kuenishi
Copy link
Contributor

This is cherry-pick of #7, for basho/riak_cs#1047. Needs tagging and webmachine update followed.

shino added 2 commits January 15, 2015 20:20
RFC 2616 14.35.1 Byte Ranges

   If the last-byte-pos value is absent, or if the value is greater than
   or equal to the current length of the entity-body, last-byte-pos is
   taken to be equal to one less than the current length of the entity-
   body in bytes.

Conflicts:
	src/mochiweb_http.erl
@shino
Copy link
Contributor

shino commented Jan 16, 2015

Was there any conflict in cherry-pick?
I guess range_skip_length was independently fixed in upstream (mochi's) repository [1] and incorporated in this fork by #15 [2].

[1] mochi/mochiweb@fe5e0c5?w=1
[2] b802b92

@shino
Copy link
Contributor

shino commented Jan 16, 2015

Ah, you did right.
The upstream change had a bug in case Size < Start < End. So, as you did, we should adopt the one in #7.

@@ -273,6 +271,8 @@ range_skip_length_test() ->
%% invalid ranges
?assertEqual(invalid_range,
range_skip_length({-1, 30}, BodySize)),
?assertEqual({0, BodySize},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test cases around this are all for invalid_rage as an comment at line 271 (new) says.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are already cases for Size < End around line 258, this case should move to there.

@shino
Copy link
Contributor

shino commented Jan 16, 2015

The test case to catch the bug when Size < Start < End at current master (bff08e8).

    ?assertEqual(invalid_range,
                 range_skip_length({BodySize + 1, BodySize + 5}, BodySize)),

@kuenishi
Copy link
Contributor Author

Okay, here's updated unitests.

@shino
Copy link
Contributor

shino commented Jan 16, 2015

Code looks nice, eunit test pass.
I will +1 after Riak CS's test passes.

@shino
Copy link
Contributor

shino commented Jan 16, 2015

This fix works well.
+1 to merge.

kuenishi added a commit that referenced this pull request Jan 16, 2015
@kuenishi kuenishi merged commit ade2a9b into master Jan 16, 2015
@kuenishi kuenishi deleted the ku-range-fix branch January 16, 2015 07:38
@kuenishi
Copy link
Contributor Author

Tagged v2.9.0p1 for this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants