zhanhb commented 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. [Line L559](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dL559) I don't think is a good practise to referrer package visible class in another source file. [Line 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. [Line L1016-R1018](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dL1016-R1018) Clean the source. Might be incompatible if a user define a class extends DefaultServlet and parse the range himself with parameter or another header field. But maybe we should not consider such case. We should make the method `parseRange` meaningful and easy to maintain. [Line R1448-R1451](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dR1448-R1451) Report a full range for such as HEAD request. All other request methods should not contains a `Range` header. [Line 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.) [Line 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. [Line 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-355391a6aff99c525e8cd9165efd395dR1490) Make method parseRange meaningfull and easier to maintain. [Line 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 it does not understand. Not change too much for a comman used user agent won't send such header "Range: none". [Line 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. [Line R1533-R1541](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395dR1533-R1541), [L1543-R1564](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395d#L1543-R1564), [L2664-R2673](https://github.com/apache/tomcat/pull/172/files#diff-355391a6aff99c525e8cd9165efd395d#L2664-R2673) For a request who is requesting a single range, we response a modified range range than 416. For a request who is requesting multiple ranges, we will remove some unsatisfiable ranges and response remain ranges. Behaviour might be incompative we will reponse a single range style for multiple range requests. 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