@@ -386,7 +386,12 @@ def _test_blocklist_header(self, header, value):
386386 )
387387 auth = self .AuthClass (credentials , 's3' , 'us-east-1' )
388388 auth .add_auth (request )
389- self .assertNotIn (header , request .headers ['Authorization' ])
389+ signed_headers = (
390+ request .headers ['Authorization' ]
391+ .split ('SignedHeaders=' , 1 )[1 ]
392+ .split (',' , 1 )[0 ]
393+ )
394+ self .assertNotIn (header .lower (), signed_headers .split (';' ))
390395
391396 def test_blocklist_expect_headers (self ):
392397 self ._test_blocklist_header ('expect' , '100-continue' )
@@ -402,6 +407,31 @@ def test_blocklist_user_agent_header(self):
402407 def test_blocklist_transfer_encoding_header (self ):
403408 self ._test_blocklist_header ('transfer-encoding' , 'chunked' )
404409
410+ def test_blocklist_connection_header (self ):
411+ self ._test_blocklist_header ('connection' , 'keep-alive' )
412+
413+ def test_blocklist_keep_alive_header (self ):
414+ self ._test_blocklist_header ('keep-alive' , 'timeout=5' )
415+
416+ def test_blocklist_proxy_authenticate_header (self ):
417+ self ._test_blocklist_header (
418+ 'proxy-authenticate' , 'Basic realm="proxy.example.com"'
419+ )
420+
421+ def test_blocklist_proxy_authorization_header (self ):
422+ self ._test_blocklist_header (
423+ 'proxy-authorization' , 'Basic YWxhZGRpbjpvcGVuc2VzYW1l'
424+ )
425+
426+ def test_blocklist_te_header (self ):
427+ self ._test_blocklist_header ('te' , 'trailers' )
428+
429+ def test_blocklist_trailer_header (self ):
430+ self ._test_blocklist_header ('trailer' , 'x-amz-checksum-sha256' )
431+
432+ def test_blocklist_upgrade_header (self ):
433+ self ._test_blocklist_header ('upgrade' , 'websocket' )
434+
405435 def test_uses_sha256_if_config_value_is_true (self ):
406436 self .client_config .s3 ['payload_signing_enabled' ] = True
407437 self .auth .add_auth (self .request )
0 commit comments