Handle the case where an empty range is requested #680

Closed
wants to merge 1 commit into
from

Projects

None yet

3 participants

@mitchellrj

If a client makes a request to a static resource with a range header (for example) of 400-400 (valid HTTP), this iterator will fail at this point. It is better to check the block size here, as we would still want to raise other errors at this point.

@mitchellrj mitchellrj Handle the case where an empty range is requested
If a client makes a request to a static resource with a range header (for example) of 400-400 (valid HTTP), this iterator will fail at this point. It is better to check the block size here, as we would still want to raise other errors at this point.
d9ff18a
@mcdonc
Member
mcdonc commented Sep 4, 2012

This looks good! Could I tweak you into adding a test for the case?

@mcdonc
Member
mcdonc commented Sep 15, 2012

Err now that I look at the code in context, it doesn't appear that Pyramid itself creates a FileIter with anything other than a fixed _BLOCK_SIZE of 256K. Under what circumstance will self.block_size be 0?

@mcdonc
Member
mcdonc commented Feb 10, 2013

FYI, I'm going to close this in about a week or so without OP response.

@mmerickel
Member

There may be an issue with handling an empty range, but I can't imagine that it is in FileIter. As @mcdonc already pointed out, there's nowhere in pyramid that modifies the block size.

Closing this issue until a valid test case pops up demonstrating that a range request actually fails.

@mmerickel mmerickel closed this Mar 13, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment