Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D98F3200D4F for ; Wed, 22 Nov 2017 01:54:05 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id D7D4B160BFC; Wed, 22 Nov 2017 00:54:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2AB17160C0F for ; Wed, 22 Nov 2017 01:54:05 +0100 (CET) Received: (qmail 99455 invoked by uid 500); 22 Nov 2017 00:54:04 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 99440 invoked by uid 99); 22 Nov 2017 00:54:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Nov 2017 00:54:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 433791A0E07 for ; Wed, 22 Nov 2017 00:54:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 53PA_8_WbFGR for ; Wed, 22 Nov 2017 00:54:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 7E80E5FDE0 for ; Wed, 22 Nov 2017 00:54:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id B982BE126D for ; Wed, 22 Nov 2017 00:54:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 5C475255AD for ; Wed, 22 Nov 2017 00:54:00 +0000 (UTC) Date: Wed, 22 Nov 2017 00:54:00 +0000 (UTC) From: "Vishal Mishra (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Closed] (CB-11067) Content-Length missing in multipart form upload header on Android MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 22 Nov 2017 00:54:06 -0000 [ https://issues.apache.org/jira/browse/CB-11067?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Vishal Mishra closed CB-11067. ------------------------------ Resolution: Won't Fix With the new features introduced in [XMLHttpRequest|https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest], this plugin is not needed any more. Migrating from this plugin to using the new features of [XMLHttpRequest|https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest], is explained in this [Cordova blog post|https://cordova.apache.org/blog/2017/10/18/from-filetransfer-to-xhr2.html]. > Content-Length missing in multipart form upload header on Android > ----------------------------------------------------------------- > > Key: CB-11067 > URL: https://issues.apache.org/jira/browse/CB-11067 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-plugin-file-transfer (DEPRECATED) > Environment: Plugin version 1.5.0 > chunked = false > Reporter: Odd Christer Brovig > Labels: Android, triaged > > On iOS Content-Length is sent as part of header for multipart form. On Android only Content-Disposition and Content-Type is sent. > Is there a special reason for this? I see that the file size is read after the beforeData is converted to bytes. > From FileTransfer.java: > {code:java} > beforeData.append(LINE_START).append(BOUNDARY).append(LINE_END); > beforeData.append("Content-Disposition: form-data; name=\"").append(fileKey).append("\";"); > beforeData.append(" filename=\"").append(fileName).append('"').append(LINE_END); > beforeData.append("Content-Type: ").append(mimeType).append(LINE_END).append(LINE_END); > byte[] beforeDataBytes = beforeData.toString().getBytes("UTF-8"); > byte[] tailParamsBytes = (LINE_END + LINE_START + BOUNDARY + LINE_START + LINE_END).getBytes("UTF-8"); > {code} > From CDVFileTransfer.m: > {code} > [postBodyBeforeFile appendData:formBoundaryData]; > [postBodyBeforeFile appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"; filename=\"%@\"\r\n", fileKey, fileName] dataUsingEncoding:NSUTF8StringEncoding]]; > if (mimeType != nil) { > [postBodyBeforeFile appendData:[[NSString stringWithFormat:@"Content-Type: %@\r\n", mimeType] dataUsingEncoding:NSUTF8StringEncoding]]; > } > [postBodyBeforeFile appendData:[[NSString stringWithFormat:@"Content-Length: %ld\r\n\r\n", (long)[fileData length]] dataUsingEncoding:NSUTF8StringEncoding]]; > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org For additional commands, e-mail: issues-help@cordova.apache.org