Gargi Jaiswal created HDDS-17141:
------------------------------------

             Summary: S3 Gateway Range header parsing returns wrong status for 
unsatisfiable and malformed ranges
                 Key: HDDS-17141
                 URL: https://issues.apache.org/jira/browse/HDDS-17141
             Project: Apache Ozone
          Issue Type: Task
            Reporter: Gargi Jaiswal
            Assignee: Gargi Jaiswal


{color:#00875a}RangeHeaderParserUtil#parseRangeHeader{color} mishandles some 
edge-case Range values. Ozone returns 200 or 206 where AWS S3 returns 416 
InvalidRange, and in two cases sends a malformed Content-Range header. The 
parser is shared, so this affects *GetObject* today and *HeadObject* once 
[HDDS-14224|https://issues.apache.org/jira/browse/HDDS-14224] is merged.

*Examples  -> suppose 10-byte object is created*
{code:java}
|| Range     || Ozone                             || AWS S3 ||
| bytes=10-   | 200, full object                   | 416 InvalidRange |
| bytes=-0    | 206, Content-Range: bytes 10-9/10  | 416 InvalidRange |
| bytes=-5 (empty object) | 206, Content-Range: bytes 0--1/0 | 416 InvalidRange 
|
| bytes=-    | 206, Content-Range: bytes 1-9/10 (drops byte 0) | 200, full 
object (header ignored) |{code}
For comparison, bytes=10-20 already returns 416 correctly.

*Reason*
An empty end is replaced with length-1 before the "end beyond object" check, so 
bytes=10- is never marked invalid. Suffix ranges are not checked for a zero 
suffix length, a zero-length object, or a missing suffix value.

*- Found while reviewing HDDS-14224 (PR 
https://github.com/apache/ozone/pull/11612)*



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to