plusplusjiajia commented on code in PR #3120:
URL: https://github.com/apache/iceberg-python/pull/3120#discussion_r2969339841


##########
pyiceberg/catalog/rest/__init__.py:
##########
@@ -686,6 +688,12 @@ def _init_sigv4(self, session: Session) -> None:
         from requests import PreparedRequest
         from requests.adapters import HTTPAdapter
 
+        class _IcebergSigV4Auth(SigV4Auth):
+            def canonical_request(self, request: Any) -> str:
+                cr = super().canonical_request(request)
+                # Replace the last line (body_checksum) with hex-encoded 
payload hash.
+                return cr.rsplit("\n", 1)[0] + "\n" + self.payload(request)

Review Comment:
   > im confused why the _IcebergSigV4Auth class is needed
   
    The _IcebergSigV4Auth class is needed because botocore's 
SigV4Auth.canonical_request uses the X-Amz-Content-SHA256 header value directly 
as the body checksum when present. Since we set this header to base64, we need 
to override canonical_request to always use hex-encoded self.payload(request) 
instead.



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