Apache Cordova
  1. Apache Cordova
  2. CB-74

Add ContentLength Header in Upload request

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.0
    • Fix Version/s: 1.6.0
    • Component/s: Android
    • Labels:
      None

      Description

      Some servers require a ContentLength on POST requests.

        Issue Links

          Activity

          Simon MacDonald created issue -
          Simon MacDonald made changes -
          Field Original Value New Value
          Component/s BlackBerry [ 12316402 ]
          Component/s iOS [ 12316400 ]
          Hide
          Bennet Huber added a comment -

          As a workaround, I've found there's an undocumented argument you can set on the options that fixes this:

          var ft = new FileTransfer();
          //Set more stuff here...
          var opts = {};
          opts.chunkedMode = false;
          ft.upload(fileURI, serverURL, onSuccess, onFail, opts);

          This somehow magically makes Android set the content length for the POST request, I'm not entirely sure why though. Found the fix on http://www.countermarch.com/blog/index.cfm/2011/10/27/PhoneGap-FileTransfer-and-ColdFusion

          Show
          Bennet Huber added a comment - As a workaround, I've found there's an undocumented argument you can set on the options that fixes this: var ft = new FileTransfer(); //Set more stuff here... var opts = {}; opts.chunkedMode = false; ft.upload(fileURI, serverURL, onSuccess, onFail, opts); This somehow magically makes Android set the content length for the POST request, I'm not entirely sure why though. Found the fix on http://www.countermarch.com/blog/index.cfm/2011/10/27/PhoneGap-FileTransfer-and-ColdFusion
          Hide
          Filip Maj added a comment -

          Content-Length header has been a part of the BlackBerry source since the first version of the FileUpload class by Justin, over a year ago.

          See: https://github.com/callback/callback-blackberry/commit/3985e1156e5c989e52b5fe65b91424075260c05b

          Yay!

          Show
          Filip Maj added a comment - Content-Length header has been a part of the BlackBerry source since the first version of the FileUpload class by Justin, over a year ago. See: https://github.com/callback/callback-blackberry/commit/3985e1156e5c989e52b5fe65b91424075260c05b Yay!
          Filip Maj made changes -
          Component/s BlackBerry [ 12316402 ]
          Joe Bowser made changes -
          Fix Version/s 1.6.0 [ 12319548 ]
          Shazron Abdullah made changes -
          Link This issue is cloned as CB-236 [ CB-236 ]
          Shazron Abdullah made changes -
          Component/s iOS [ 12316400 ]
          Shazron Abdullah made changes -
          Link This issue relates to CB-236 [ CB-236 ]
          Joe Bowser made changes -
          Assignee Joe Bowser [ bowserj ]
          Hide
          Joe Bowser added a comment -

          Should be fixed on Master. Changed mode to switch between chunking and streaming

          Show
          Joe Bowser added a comment - Should be fixed on Master. Changed mode to switch between chunking and streaming
          Joe Bowser made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Joe Bowser made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Hide
          Joe Bowser added a comment -

          Trying to resolve issue in JIRA, JIRA seems to not want to let me do it.

          Show
          Joe Bowser added a comment - Trying to resolve issue in JIRA, JIRA seems to not want to let me do it.
          Joe Bowser made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          105d 15h 25m 1 Joe Bowser 13/Mar/12 18:48
          Resolved Resolved Reopened Reopened
          1m 31s 1 Joe Bowser 13/Mar/12 18:49
          Reopened Reopened Resolved Resolved
          18s 1 Joe Bowser 13/Mar/12 18:50

            People

            • Assignee:
              Joe Bowser
              Reporter:
              Simon MacDonald
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development