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 B9B6A200C59 for ; Mon, 17 Apr 2017 22:50:51 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B8634160BAB; Mon, 17 Apr 2017 20:50:51 +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 0C5DE160B92 for ; Mon, 17 Apr 2017 22:50:50 +0200 (CEST) Received: (qmail 60846 invoked by uid 500); 17 Apr 2017 20:50:50 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 60818 invoked by uid 99); 17 Apr 2017 20:50:49 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Apr 2017 20:50:49 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 7C43DC04EF for ; Mon, 17 Apr 2017 20:50:49 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.38 X-Spam-Level: ** X-Spam-Status: No, score=2.38 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001, WEIRD_PORT=0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id GmGilefg2XZg for ; Mon, 17 Apr 2017 20:50:45 +0000 (UTC) Received: from mail-qt0-f170.google.com (mail-qt0-f170.google.com [209.85.216.170]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 10AA55F306 for ; Mon, 17 Apr 2017 20:50:45 +0000 (UTC) Received: by mail-qt0-f170.google.com with SMTP id c45so110360449qtb.1 for ; Mon, 17 Apr 2017 13:50:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=4xiLTU2GZudtpHy+LofD6Ba8RX85slbyQn7F1INUUHo=; b=uRqEc3q/v6CMxBBUraBMVuhxol26OnIf7lXya3ifmbf1LqD7aXmwIGZMZBR8gQ385s tr5MMT2QMsAUumRQ00HwNEBQA4REj4XuWzvjUEMwrqgoYdQ7YNID8L9w6K3HFqWnduLU LR4xvIJ8aKjAmImM2D9gRDytW2phFzUWdk4HBQENgvZfESzsREXzvu72+qEqGVSl2HzO IBkJKslyyERLpsPkxwQeZAqWVbGYN2zfSFZcNdQZwUomdhyczJQYy+T92eH+ITTnzk8w bD5rG1Awymk0ehiM3hjwgKXG027eGRvTp/KCsHmkSzRVjhbyaG+qEsrezJUXa8OKveKc jBDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=4xiLTU2GZudtpHy+LofD6Ba8RX85slbyQn7F1INUUHo=; b=bZPvD5QOY55ztlf8nUgnXvkwozDrpv+8PKRDFYWbrurHqHX+xCFkmc0zC61T3zStvN +SI7xcMvAMiBhxravdQcYzg1HhWD9NYgshroD1CDyMbkdKbYN5tKRklYs6c//aEbk2Z3 BZ17AxP60ZHQBVPWTBofJEEMUt6F4u/LWUDjsMqn3MTzHJmqYZakQalchrv4ku0AdFrr dHtEtL+7MqqJVjKgx8yKwP74lrqD5qdqzJGyDUaGeuHjkSiUGaCwXR1QlFjz8hHutkxR lXn+aqZRR1al9MUdJHceyd4L/8t/92YKW6xiV7CRZL96hTHRQzhiKVYH0aq93rtYPdTJ BK2A== X-Gm-Message-State: AN3rC/7RkpjushtZFeVXZ0fCLp4pblN/1q74r8wJdDAm0W4Uva1gPx/F o8AgXyCwvL+9kIDG3F/jtqt3+sR7+GXT X-Received: by 10.237.37.213 with SMTP id y21mr11824990qtc.20.1492462243811; Mon, 17 Apr 2017 13:50:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.175.183 with HTTP; Mon, 17 Apr 2017 13:50:43 -0700 (PDT) From: Philippe Mouawad Date: Mon, 17 Apr 2017 22:50:43 +0200 Message-ID: Subject: MultipartEntityBuilder and Charset US-ASCII To: HttpClient User Discussion Cc: "dev@jmeter.apache.org" Content-Type: multipart/alternative; boundary=001a113fe498e23dc3054d62f1b1 archived-at: Mon, 17 Apr 2017 20:50:51 -0000 --001a113fe498e23dc3054d62f1b1 Content-Type: text/plain; charset=UTF-8 Hello, At JMeter we have a bug report ( https://bz.apache.org/bugzilla/show_bug.cgi?id=60800) related to Multipart Form POST request A user reports that he has an issue with a request created by JMeter due to the presence in Request Headers of "charset=US-ASCII" at end of boundary in Content-Type. ------------------------------------------------------------------------ POST http://localhost:8081/ POST data: --5v5So93EEOXPO8DIg4kmR-vfmsbimn Content-Disposition: form-data; name="toto" titi --5v5So93EEOXPO8DIg4kmR-vfmsbimn-- *Request Headers:* Connection: keep-alive Content-Length: 123 *Content-Type: multipart/form-data; boundary=5v5So93EEOXPO8DIg4kmR-vfmsbimn; charset=US-ASCII* Host: localhost:8081 User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_121) ------------------------------------------------------------------------ The code is created through ( https://github.com/apache/jmeter/blob/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java#L1201 ): 1/ MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create(); 2/ As not Content Type is set in GUI, we default to US-ASCII so call: multipartEntityBuilder.setCharset("US-ASCII"); 3/ multipartEntityBuilder.setLaxMode(); 4/ For every parameter: StringBody stringBody = new StringBody(arg.getValue(), ContentType.create("text/plain", charset)); FormBodyPart formPart = FormBodyPartBuilder.create( parameterName, stringBody).build(); multipartEntityBuilder.addPart(formPart); 5/ HttpEntity entity = multipartEntityBuilder.build(); post.setEntity(entity); So my questions are the following: 1/ Is it correct to add this charset part ? 2/ Could you point me to the reference part of RFC that mentions this ? 3/ Is it correct to avoid setting charset in this case in API which would lead to such request instead ? POST http://localhost:8081/ POST data: --xjNHd_UhEEpqC2ZoFCpGRzYzHK90ljsdpfTr Content-Disposition: form-data; name="toto" titi --xjNHd_UhEEpqC2ZoFCpGRzYzHK90ljsdpfTr-- Request Headers: Connection: keep-alive Content-Length: 135 Content-Type: multipart/form-data; boundary=xjNHd_UhEEpqC2ZoFCpGRzYzHK90ljsdpfTr Host: localhost:8081 User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_121) Thanks for your help Regards Philippe M. --001a113fe498e23dc3054d62f1b1--