Skip to content

Commit

Permalink
Remove Transfer-Encoding from streaming signature
Browse files Browse the repository at this point in the history
http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-streaming.html 
doesn't provide any detail related to `Transfer-Encoding` to be a valid 
header as a requirement. 

Additionally also Transfer-Encoding is used as part of signature 
request incorrectly because the transfer coding names are case 
insensitive[1] i.e when the canonical request is generated should
be generated as lower cased value instead.

```
content-encoding:aws-chunked
content-type:image/jpeg
host:***REDACTED***
transfer-encoding:Chunked
user-agent:aws-sdk-iOS/2.5.2 iOS/10.2 en_US transfer-manager
x-amz-acl:public-read
x-amz-content-sha256:STREAMING-AWS4-HMAC-SHA256-PAYLOAD
x-amz-date:20170413T050829Z
x-amz-decoded-content-length:1024000
```

[1] - http://greenbytes.de/tech/webdav/rfc7230.html#transfer.codings
  • Loading branch information
harshavardhana committed Apr 13, 2017
1 parent 4ec5448 commit a3780f6
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion AWSCore/Authentication/AWSSignature.m
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ - (NSString *)signS3RequestV4:(NSMutableURLRequest *)urlRequest
[urlRequest setValue:[NSString stringWithFormat:@"%lu", (unsigned long)[AWSS3ChunkedEncodingInputStream computeContentLengthForChunkedData:contentLength]]
forHTTPHeaderField:@"Content-Length"];
[urlRequest setValue:nil forHTTPHeaderField:@"Content-Length"]; //remove Content-Length header if it is a HTTPBodyStream
[urlRequest setValue:@"Chunked" forHTTPHeaderField:@"Transfer-Encoding"];
[urlRequest addValue:@"aws-chunked" forHTTPHeaderField:@"Content-Encoding"]; //add aws-chunked keyword for s3 chunk upload
[urlRequest setValue:[NSString stringWithFormat:@"%lu", (unsigned long)contentLength] forHTTPHeaderField:@"x-amz-decoded-content-length"];
} else {
Expand Down

0 comments on commit a3780f6

Please sign in to comment.