[ https://issues.apache.org/jira/browse/CB-10974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15956431#comment-15956431
]
ASF GitHub Bot commented on CB-10974:
-------------------------------------
Github user cooperjbrandon commented on the issue:
https://github.com/apache/cordova-plugin-file-transfer/pull/141
I have this same exact issue trying to upload to s3. I also got the error message :
```
You must provide the Content-Length HTTP header.
```
TLDR: `options.chunkedMode = false;` fixes it.
Longer:
Not exactly sure, but maybe s3 doesn't like the `Transfer-Encoding` header? When doing
`conn.setFixedLengthStreamingMode(fixedLength);`, I no longer get a 411. This is accomplished
by setting `chunkedMode` to false. By doing that, this line runs: https://github.com/apache/cordova-plugin-file-transfer/blob/master/src/android/FileTransfer.java#L442
.
Another possibility is that s3 does allow chunked mode, but we need to set additional
headers on the request to make it work.
> Cordova file transfer Content-Length header problem
> ---------------------------------------------------
>
> Key: CB-10974
> URL: https://issues.apache.org/jira/browse/CB-10974
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugin File Transfer
> Environment: iPad Mini 2 with iOS 9.3
> Reporter: Roman Lapotchkin
> Assignee: Sergey Shakhnazarov
> Labels: iOS, triaged
>
> The Content-Length header always sending even options.chunkedMode is true. It expected
header Transfer-Encoding: chuncked. When i commented this code in src/ios/CDVFileTransfer.m
at line 232 it works:
> [req setValue:[[NSNumber numberWithLongLong:totalPayloadLength] stringValue] forHTTPHeaderField:@"Content-Length"];
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
|