You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Bablu Raul (Jira)" <ji...@apache.org> on 2026/10/21 08:34:00 UTC

[jira] [Updated] (HDDS-17234) HeadObject Does Not Honor the Range Header and Returns the Full Content-Length Instead of the Requested Range Length

     [ https://issues.apache.org/jira/browse/HDDS-17234?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bablu Raul updated HDDS-17234:
------------------------------
    Description: 
When an S3 {{HeadObject}} request is made with a {{Range}} header (for example, {{{}bytes=0-2{}}}) on an object created using {{{}PutObject{}}}, the Ozone S3 Gateway returns the full-object metadata instead of the metadata corresponding to the requested range.

In comparison, {{GetObject}} with the same {{Range}} header correctly returns partial content metadata for the same object.

For example, {{GetObject}} with {{Range: bytes=0-2}} returns {{ContentLength: 3}} and {{{}ContentRange: bytes 0-2/11{}}}, whereas {{HeadObject}} with the same range returns {{ContentLength: 11}} and does not include {{{}ContentRange{}}}.

The {{{}ETag{}}}, {{{}Last-Modified{}}}, and stored {{Content-Type}} values remain consistent between the two operations, confirming that both requests refer to the same object.

*Steps to Reproduce*
 # Configure and start the Ozone S3 Gateway.

 # Authenticate using valid Kerberos credentials and configure the S3 credentials.

 # Create a bucket and upload an object containing 11 bytes.

 # Execute a {{GetObject}} request with the range {{{}bytes=0-2{}}}.

 # Execute a {{HeadObject}} request with the same range {{{}bytes=0-2{}}}.

 # Compare the {{{}ContentLength{}}}, {{{}ContentRange{}}}, {{{}ETag{}}}, and {{LastModified}} values returned by both operations.

Example commands:

 
{code:java}
{{aws --no-verify-ssl --endpoint-url "$S3_EP" \
s3api get-object \
--bucket "$BUCKET" \
--key "$KEY" \
/tmp/out.bin \
--range bytes=0-2}}{code}
 
{code:java}
{{aws --no-verify-ssl --endpoint-url "$S3_EP" \
s3api head-object \
--bucket "$BUCKET" \
--key "$KEY" \
--range bytes=0-2}}{code}
*Actual Result*
 * {{GetObject}} returns {{ContentLength: 3}} and {{{}ContentRange: bytes 0-2/11{}}}.

 * The downloaded object contains 3 bytes.

 * {{HeadObject}} returns {{{}ContentLength: 11{}}}, representing the full object size.

 * {{HeadObject}} does not return the {{ContentRange}} field.

 * The {{Range}} request appears to be ignored by {{{}HeadObject{}}}, although {{GetObject}} honors the same range.

*Expected Result*

The Ozone S3 Gateway should handle {{HeadObject}} requests with a {{Range}} header consistently with the expected S3 API behavior.

When {{HeadObject}} is called with {{{}Range: bytes=0-2{}}}, it should return appropriate range-related metadata, such as {{ContentLength: 3}} and {{{}ContentRange: bytes 0-2/11{}}}, rather than reporting the full object length.

The {{{}ETag{}}}, {{{}Last-Modified{}}}, and stored {{Content-Type}} values should remain consistent across both operations for the same object.

  was:
When an S3 {{HeadObject}} request is made with a {{Range}} header (for example, {{{}bytes=0-2{}}}) on an object created using {{{}PutObject{}}}, the Ozone S3 Gateway returns the full-object metadata instead of the metadata corresponding to the requested range.

In comparison, {{GetObject}} with the same {{Range}} header correctly returns partial content metadata for the same object.

For example, {{GetObject}} with {{Range: bytes=0-2}} returns {{ContentLength: 3}} and {{{}ContentRange: bytes 0-2/11{}}}, whereas {{HeadObject}} with the same range returns {{ContentLength: 11}} and does not include {{{}ContentRange{}}}.

The {{{}ETag{}}}, {{{}Last-Modified{}}}, and stored {{Content-Type}} values remain consistent between the two operations, confirming that both requests refer to the same object.

*Steps to Reproduce*
 # Configure and start the Ozone S3 Gateway.

 # Authenticate using valid Kerberos credentials and configure the S3 credentials.

 # Create a bucket and upload an object containing 11 bytes.

 # Execute a {{GetObject}} request with the range {{{}bytes=0-2{}}}.

 # Execute a {{HeadObject}} request with the same range {{{}bytes=0-2{}}}.

 # Compare the {{{}ContentLength{}}}, {{{}ContentRange{}}}, {{{}ETag{}}}, and {{LastModified}} values returned by both operations.

Example commands:

 

{{aws --no-verify-ssl --endpoint-url "$S3_EP" \
  s3api get-object \
  --bucket "$BUCKET" \
  --key "$KEY" \
  /tmp/out.bin \
  --range bytes=0-2}}

 

{{aws --no-verify-ssl --endpoint-url "$S3_EP" \
  s3api head-object \
  --bucket "$BUCKET" \
  --key "$KEY" \
  --range bytes=0-2}}

*Actual Result*
 * {{GetObject}} returns {{ContentLength: 3}} and {{{}ContentRange: bytes 0-2/11{}}}.

 * The downloaded object contains 3 bytes.

 * {{HeadObject}} returns {{{}ContentLength: 11{}}}, representing the full object size.

 * {{HeadObject}} does not return the {{ContentRange}} field.

 * The {{Range}} request appears to be ignored by {{{}HeadObject{}}}, although {{GetObject}} honors the same range.

*Expected Result*

The Ozone S3 Gateway should handle {{HeadObject}} requests with a {{Range}} header consistently with the expected S3 API behavior.

When {{HeadObject}} is called with {{{}Range: bytes=0-2{}}}, it should return appropriate range-related metadata, such as {{ContentLength: 3}} and {{{}ContentRange: bytes 0-2/11{}}}, rather than reporting the full object length.

The {{{}ETag{}}}, {{{}Last-Modified{}}}, and stored {{Content-Type}} values should remain consistent across both operations for the same object.


> HeadObject Does Not Honor the Range Header and Returns the Full Content-Length Instead of the Requested Range Length
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: HDDS-17234
>                 URL: https://issues.apache.org/jira/browse/HDDS-17234
>             Project: Apache Ozone
>          Issue Type: Bug
>          Components: S3, s3gateway
>            Reporter: Bablu Raul
>            Priority: Major
>
> When an S3 {{HeadObject}} request is made with a {{Range}} header (for example, {{{}bytes=0-2{}}}) on an object created using {{{}PutObject{}}}, the Ozone S3 Gateway returns the full-object metadata instead of the metadata corresponding to the requested range.
> In comparison, {{GetObject}} with the same {{Range}} header correctly returns partial content metadata for the same object.
> For example, {{GetObject}} with {{Range: bytes=0-2}} returns {{ContentLength: 3}} and {{{}ContentRange: bytes 0-2/11{}}}, whereas {{HeadObject}} with the same range returns {{ContentLength: 11}} and does not include {{{}ContentRange{}}}.
> The {{{}ETag{}}}, {{{}Last-Modified{}}}, and stored {{Content-Type}} values remain consistent between the two operations, confirming that both requests refer to the same object.
> *Steps to Reproduce*
>  # Configure and start the Ozone S3 Gateway.
>  # Authenticate using valid Kerberos credentials and configure the S3 credentials.
>  # Create a bucket and upload an object containing 11 bytes.
>  # Execute a {{GetObject}} request with the range {{{}bytes=0-2{}}}.
>  # Execute a {{HeadObject}} request with the same range {{{}bytes=0-2{}}}.
>  # Compare the {{{}ContentLength{}}}, {{{}ContentRange{}}}, {{{}ETag{}}}, and {{LastModified}} values returned by both operations.
> Example commands:
>  
> {code:java}
> {{aws --no-verify-ssl --endpoint-url "$S3_EP" \
> s3api get-object \
> --bucket "$BUCKET" \
> --key "$KEY" \
> /tmp/out.bin \
> --range bytes=0-2}}{code}
>  
> {code:java}
> {{aws --no-verify-ssl --endpoint-url "$S3_EP" \
> s3api head-object \
> --bucket "$BUCKET" \
> --key "$KEY" \
> --range bytes=0-2}}{code}
> *Actual Result*
>  * {{GetObject}} returns {{ContentLength: 3}} and {{{}ContentRange: bytes 0-2/11{}}}.
>  * The downloaded object contains 3 bytes.
>  * {{HeadObject}} returns {{{}ContentLength: 11{}}}, representing the full object size.
>  * {{HeadObject}} does not return the {{ContentRange}} field.
>  * The {{Range}} request appears to be ignored by {{{}HeadObject{}}}, although {{GetObject}} honors the same range.
> *Expected Result*
> The Ozone S3 Gateway should handle {{HeadObject}} requests with a {{Range}} header consistently with the expected S3 API behavior.
> When {{HeadObject}} is called with {{{}Range: bytes=0-2{}}}, it should return appropriate range-related metadata, such as {{ContentLength: 3}} and {{{}ContentRange: bytes 0-2/11{}}}, rather than reporting the full object length.
> The {{{}ETag{}}}, {{{}Last-Modified{}}}, and stored {{Content-Type}} values should remain consistent across both operations for the same object.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org