Ankitraj-builds opened a new pull request, #4270:
URL: https://github.com/apache/iceberg-python/pull/4270

   Closes #2422
   
   # Rationale for this change
   
   `S3V4RestSigner` adds the headers returned by the signing service with 
`add_header`, which appends. A header the request already had, such as 
`X-Amz-Content-SHA256` set by botocore, is then sent twice: once with the 
original value and once with the signed value. The signature only covers the 
signed value, so stricter S3-compatible stores reject the request. The same 
duplication was measured in #3896.
   
   This deletes the existing header (case-insensitive) before adding the signed 
value, so each signed header is sent once, with the value the signer returned.
   
   ## Are these changes tested?
   
   Yes. `test_s3v4_rest_signer_replaces_existing_headers` in 
`tests/io/test_fsspec.py` sends a request that already has 
`X-Amz-Content-SHA256` and `User-Agent`, and checks that after signing each 
header appears once with the signed value. It fails on main and passes with 
this change. All signer tests in the file pass.
   
   ## Are there any user-facing changes?
   
   Signed S3 requests no longer carry duplicate headers. No configuration 
changes.
   


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