zhanhb edited a comment on issue #172: Process request range as specified in RFC 7233 URL: https://github.com/apache/tomcat/pull/172#issuecomment-504718438 Before I write unit tests, maybe I need to explain what I my PR do. - [L559-R559](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dL559-R559) I don't think it is a good practise to referrer a package visible class in another source file. - [R602-R603](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dR602-R603) Add comment, which might be done in tomcat 10 or future release. - [L1016-R1018](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dL1016-R1018) Clean the source, make the method `parseRange` meaningful and easy to maintain. Might be incompatible if a user defines a class extending DefaultServlet, override the method `parseRange` and parse the range himself with parameter or another header field. But maybe we should not consider such case. - [R1448-R1451](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dR1448-R1451) Report a full range for requests other than GET methods even HEAD requests. Except HEAD request, it's obvious to see for other request methods header `Range` should be ignored. - [L1464-R1473](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dL1464-R1473) As specified in [rfc7233#3.2](https://tools.ietf.org/html/rfc7233#section-3.2), apply strong validator on etags. (My opinion now is that this should not be applied.) - [L1471-R1481](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dL1471-R1481) Our etag depends the modified time and sizeof the file. This won't change too much. - [L1440-R1441](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dL1490-R1441), [L1490](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dL1490), [R1497](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dR1497) Make method `parseRange` meaningful and easier to maintain. - [L1491-L1492](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dL1491-L1492), [R1498-R1501](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dR1498-R1501) [rfc7233#3.1](https://tools.ietf.org/html/rfc7233#section-3.1) says that we must ignore a Range header field that contains a range unit we do not understand. Not change too much for a common used user agent won't send such header "Range: none". - [L1508-R1519](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dL1508-R1519), [L1517-R1528](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dL1517-R1528), [L1530-R1544](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dL1530-R1544), [L1550-R1564](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dL1530-R1564), [L1570-R1579](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dL1570-R1579) no change, just clean the source. - [R1533-R1541](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dR1533-R1541), [L1543-R1561](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dL1543-R1561), [L2664-R2673](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dL2664-R2673) 1. For a request who is requesting a single range, we response a modified range range than 416. 2. For a request who is requesting multiple ranges, we will remove some unsatisfiable ranges and response remain ranges. Behaviour might be incompative, we might reponse a single range style for multiple range requests. 3. For a put request, original implementation will be OK if such request is sent "Content-Range: 1-5/4". The meaning for method `Range.validate` is `isSatisfiable` for GET method, `isValid` for PUT method.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org