You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by daserge <gi...@git.apache.org> on 2016/04/14 16:13:19 UTC

[GitHub] cordova-plugin-file-transfer pull request: CB-10974 Cordova file t...

GitHub user daserge opened a pull request:

    https://github.com/apache/cordova-plugin-file-transfer/pull/141

    CB-10974 Cordova file transfer Content-Length header problem

    Fixed iOS logic to not to include Content-Length when chunkedMode=true
    Fixed Android logic preventing chunkedMode to be enabled for http uploads
    Added tests for chunkedMode
    Documented chunkedMode not supported on Windows
    Documented Uploading of an empty file is not supported for chunkedMode=true and multipart=false for iOS, pended the corresponding test
    
    [Jira issue](https://issues.apache.org/jira/browse/CB-10974)

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/MSOpenTech/cordova-plugin-file-transfer CB-10974

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-file-transfer/pull/141.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #141
    
----
commit 922b0460fed7a102a7558e90f8619e83f0735c5b
Author: daserge <v-...@microsoft.com>
Date:   2016-04-13T14:24:57Z

    CB-10974 Cordova file transfer Content-Length header problem
    
    Fixed iOS logic to not to include Content-Length when chunkedMode=true
    Fixed Android logic preventing chunkedMode to be enabled for http uploads
    Added tests for chunkedMode
    Documented chunkedMode not supported on Windows
    Documented Uploading of an empty file is not supported for chunkedMode=true and multipart=false for iOS, pended the corresponding test

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer issue #141: CB-10974 Cordova file transfer Cont...

Posted by cooperjbrandon <gi...@git.apache.org>.
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.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer issue #141: CB-10974 Cordova file transfer Cont...

Posted by daserge <gi...@git.apache.org>.
Github user daserge commented on the issue:

    https://github.com/apache/cordova-plugin-file-transfer/pull/141
  
    Oh, I think it might switch to `chunkedMode=true` because of HTTPS:
    https://github.com/apache/cordova-plugin-file-transfer/blob/2b6b6d9333848beb05a6128242701261467b5d69/src/android/FileTransfer.java#L432,L433
    
    It would be great if you could try to use this PR + `chunkedMode=false` setting and let me know if it works for you:
    https://github.com/apache/cordova-plugin-file-transfer/pull/161


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer issue #141: CB-10974 Cordova file transfer Cont...

Posted by daserge <gi...@git.apache.org>.
Github user daserge commented on the issue:

    https://github.com/apache/cordova-plugin-file-transfer/pull/141
  
    @royipr - does it attach `Transfer-Encoding` for `chunkedMode: false`?
    It should do the opposite according to [the code](https://github.com/apache/cordova-plugin-file-transfer/blob/2b6b6d9333848beb05a6128242701261467b5d69/src/android/FileTransfer.java#L440).
    Does switching to `chunkedMode: true` fix the issue?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer issue #141: CB-10974 Cordova file transfer Cont...

Posted by craig-at-rsg <gi...@git.apache.org>.
Github user craig-at-rsg commented on the issue:

    https://github.com/apache/cordova-plugin-file-transfer/pull/141
  
    @raykin Haven't found a workaround - reverted to the older version of this plugin.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer issue #141: CB-10974 Cordova file transfer Cont...

Posted by royipr <gi...@git.apache.org>.
Github user royipr commented on the issue:

    https://github.com/apache/cordova-plugin-file-transfer/pull/141
  
    Hi.
    
    I think I found a bug regarding the issue..
    When trying to upload a file with `chuckedMode: false` it seems to attach a `Transfer-Encoding` header by default. 
    This causes to upload to aws s3 to fail:
    `Message>A header you provided implies functionality that is not implemented</Message><Header>Transfer-Encoding</Header>`
    
    Take a look a this issue 
    http://stackoverflow.com/questions/39780922/cordova-file-transfer-to-s3-aws-returns-501-error


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer issue #141: CB-10974 Cordova file transfer Cont...

Posted by daserge <gi...@git.apache.org>.
Github user daserge commented on the issue:

    https://github.com/apache/cordova-plugin-file-transfer/pull/141
  
    I've tested the file-transfer tests via logging out the headers from whatheaders.com (in filetransfer.spec.27) and from local server headers echo endpoint (in `chunkedMode handling`) - and `Transfer-Encoding` is not being included in the requests.
    The only exception - is using chunkedMode=true, which leads to `Transfer-Encoding=chunked`.
    
    What Android OS version has the issue? I've tested this on 5.0.1 device.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer issue #141: CB-10974 Cordova file transfer Cont...

Posted by royipr <gi...@git.apache.org>.
Github user royipr commented on the issue:

    https://github.com/apache/cordova-plugin-file-transfer/pull/141
  
    I have tested that on 6.0.1, Sounds weird what you saying...
    I thought it might be related to AWS but if version 1.5.1 worked, there must be something broken with 1.6. If you need me to test more things let me know.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer pull request: CB-10974 Cordova file t...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cordova-plugin-file-transfer/pull/141


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer issue #141: CB-10974 Cordova file transfer Cont...

Posted by raykin <gi...@git.apache.org>.
Github user raykin commented on the issue:

    https://github.com/apache/cordova-plugin-file-transfer/pull/141
  
    same here. 
    ```shell
    E/FileTransfer(22411): {"code":1,"source":"file:\/\/\/data\/data\/com.deltux.kasa\/cache\/tmp_20161113_082947-1226504239.jpg","target":"https:\/\/s3.amazon
    aws.com\/assets-kasa-dev\/","body":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>MissingContentLength<\/Code><Message>You must provide the Cont
    ent-Length HTTP header.<\/Message><RequestId>934F1CD36D065625<\/RequestId><HostId>ma9wYyhr3H0aplxC5KQCLQMopLQz9IzfXk8o7ooq0DWe9dZM8kbqeDNmOWyAGpMmP3W8DuMym
    A4=<\/HostId><\/Error>","http_status":411,"exception":"https:\/\/s3.amazonaws.com\/assets-kasa-dev\/"}
    E/FileTransfer(22411): java.io.FileNotFoundException: https://s3.amazonaws.com/assets-kasa-dev/
    E/FileTransfer(22411):  at com.android.okhttp.internal.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:210)
    E/FileTransfer(22411):  at com.android.okhttp.internal.http.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210)
    E/FileTransfer(22411):  at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:25)
    E/FileTransfer(22411):  at org.apache.cordova.filetransfer.FileTransfer.getInputStream(FileTransfer.java:594)
    E/FileTransfer(22411):  at org.apache.cordova.filetransfer.FileTransfer.access$500(FileTransfer.java:69)
    E/FileTransfer(22411):  at org.apache.cordova.filetransfer.FileTransfer$1.run(FileTransfer.java:513)
    E/FileTransfer(22411):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    E/FileTransfer(22411):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    E/FileTransfer(22411):  at java.lang.Thread.run(Thread.java:818)
    ```
    
    another weird stuff is  
    ```shell
    adb logcat FileTransfer:* *:S
    ```
    doesn't show debug log
    
    btw, the Content-Length works on ios.
    
    @craig-at-rsg do you find workaround on android? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer issue #141: CB-10974 Cordova file transfer Cont...

Posted by vukdavid <gi...@git.apache.org>.
Github user vukdavid commented on the issue:

    https://github.com/apache/cordova-plugin-file-transfer/pull/141
  
    Facing same HTTP 411 issue: "A request with the POST method requires a valid Content-Length header."
     
    Using android with latest plugin versions:
    cordova-plugin-file-transfer@1.6.0
    cordova-plugin-file@4.3.0
    
    If I rollback to following versions it works fine:
    cordova-plugin-file-transfer@1.5.1
    cordova-plugin-file@4.2.0


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer pull request: CB-10974 Cordova file t...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on the pull request:

    https://github.com/apache/cordova-plugin-file-transfer/pull/141#issuecomment-218534776
  
    LGTM.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer issue #141: CB-10974 Cordova file transfer Cont...

Posted by craig-at-rsg <gi...@git.apache.org>.
Github user craig-at-rsg commented on the issue:

    https://github.com/apache/cordova-plugin-file-transfer/pull/141
  
    This fix is creates a problem for WSGI applications - before this fix, they would happily accept chunked transfers, but after they return status 411 and complain about a missing Content-Length header. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer issue #141: CB-10974 Cordova file transfer Cont...

Posted by daserge <gi...@git.apache.org>.
Github user daserge commented on the issue:

    https://github.com/apache/cordova-plugin-file-transfer/pull/141
  
    @cooperjbrandon what is your plugin version?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer issue #141: CB-10974 Cordova file transfer Cont...

Posted by cooperjbrandon <gi...@git.apache.org>.
Github user cooperjbrandon commented on the issue:

    https://github.com/apache/cordova-plugin-file-transfer/pull/141
  
    @daserge 1.6.2


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer issue #141: CB-10974 Cordova file transfer Cont...

Posted by royipr <gi...@git.apache.org>.
Github user royipr commented on the issue:

    https://github.com/apache/cordova-plugin-file-transfer/pull/141
  
    cool Ill check that later today!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer pull request: CB-10974 Cordova file t...

Posted by daserge <gi...@git.apache.org>.
Github user daserge commented on the pull request:

    https://github.com/apache/cordova-plugin-file-transfer/pull/141#issuecomment-209963660
  
    This PR required https://github.com/apache/cordova-labs/pull/13


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer issue #141: CB-10974 Cordova file transfer Cont...

Posted by cozzbie <gi...@git.apache.org>.
Github user cozzbie commented on the issue:

    https://github.com/apache/cordova-plugin-file-transfer/pull/141
  
    Issue seems to be mostly an android problem because same code works fine on iOS. Using @cooperjbrandon advice and adding `options.chunkedMode = false;` to just the android code fixed the issue. Thanks


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file-transfer issue #141: CB-10974 Cordova file transfer Cont...

Posted by royipr <gi...@git.apache.org>.
Github user royipr commented on the issue:

    https://github.com/apache/cordova-plugin-file-transfer/pull/141
  
    @daserge Acourding to the response it does attach Transfer-Encoding header.
    Is there a way to print the headers? I didn't saw them on `adb logcat`.
    
    Maybe the problem is here? :
    https://github.com/apache/cordova-plugin-file-transfer/commit/9347606dd33fe07ea36799b4dd28804019c68835#diff-2a8a5fef3397df87ab538f028a5c6b50R1506
    
    Maybe we should expect that the header will be undefined?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org