-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Clean method parseRange #174
Conversation
I've started to put together a unit test for this. I've committed an initial version. It is parameterised so adding additional tests should be simple. |
It's not easy for me to run a single test case now. I execute curl instead. |
tomcat/java/org/apache/catalina/servlets/DefaultServlet.java Lines 1390 to 1394 in 54ea770
How abouting chaning Line 1391 to if (!rangeHeader.startsWith("bytes=")) { Definition in rfc 2068 and rfc 7233 are same, syntax of request header 'Range' will always start with that. Client should not send malformed range headers such as |
I've re-written the Range header parsing using the code in org.apache.tomcat.util.http.parser and adding a new parser for Range. There is scope for further code reduction but that will involve API changes to the Default servlet so I'll leave that for Tomcat 10. |
Here's a test case for PUT, no other cases yet now. (Maybe need to migrate to PATCH in the future) # got 201 or 204
curl -i -X PUT --header 'Content-Range: bytes=1-5/4' --data 'abcdef' 'http://some-url-served-by-tomcat-default-servlet-and-not-readonly' |
If strong weak tag is implemented, maybe strong etag validator can be applied on header |
Here's how I parse request |
My suggestion for multiple range support: support is enough, don't let it be an entrance for DDOS attack. For this feature is specified in rfc document, many http server will supported this. But on the client side, a user agent who has a good ability to parse multi-range response usually doesn't need this feature. Single range is enough for them or capability reason. |
Partial PUT vs PATCH should be a separate topic. It will require careful consideration as some clients may depend on PUT. Support for multiple ranges should also be a separate discussion as should issues with If-Range. |
No description provided.