Gargi-jais11 commented on code in PR #11675:
URL: https://github.com/apache/ozone/pull/11675#discussion_r4345776265


##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/util/RangeHeaderParserUtil.java:
##########
@@ -56,10 +57,19 @@ public static RangeHeader parseRangeHeader(String 
rangeHeaderVal, long
       if (!matcher.group("end").equals("")) {
         end = Long.parseLong(matcher.group("end"));
       } else {
+        noEnd = true;
         end = length - 1;
       }
-      if (noStart) {
-        if (end < length) {
+      if (noStart && noEnd) {
+        // "bytes=-" has neither a first byte nor a suffix length, so it is 
ignored.
+        start = 0;
+        end = length - 1;
+        readFull = true;
+      } else if (noStart) {
+        if (end == 0 || length == 0) {

Review Comment:
   Good question. You're right that [RFC 9110 
ยง14.1.2](https://www.rfc-editor.org/rfc/rfc9110.html#section-14.1.2) treats a 
non-zero suffix range on a zero-length representation as satisfiable. I don't 
have an AWS account to test bytes=-5 directly.
   
   What I could find: 
[minio#19648](https://github.com/minio/minio/issues/19648) has a direct AWS 
measurement where Range: **bytes=0-9 on a zero-byte object returns 416 
InvalidRange** with ActualObjectSize=0, and Ceph RGW behaves the same way 
([minio#7481](https://github.com/minio/minio/issues/7481)). Those use ranges 
with a start position, not a suffix range, so they don't prove the bytes=-5 
case. I kept 416 so that every Range on an empty object behaves the same way, 
matching what S3 is known to do. The old 206 with Content-Range: bytes 0--1/0 
was invalid either way.
   
   If someone can confirm AWS returns 200 for bytes=-5 on an empty object, I'll 
switch that case to read the full (empty) object. It's a small change.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to