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 A3719200BC6 for ; Sun, 20 Nov 2016 16:02:50 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id A1F78160B07; Sun, 20 Nov 2016 15:02:50 +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 C97E0160AF1 for ; Sun, 20 Nov 2016 16:02:49 +0100 (CET) Received: (qmail 84463 invoked by uid 500); 20 Nov 2016 15:02:47 -0000 Mailing-List: contact users-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@groovy.apache.org Delivered-To: mailing list users@groovy.apache.org Received: (qmail 84437 invoked by uid 99); 20 Nov 2016 15:02:47 -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; Sun, 20 Nov 2016 15:02:47 +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 190EAC0744 for ; Sun, 20 Nov 2016 15:02:47 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.879 X-Spam-Level: *** X-Spam-Status: No, score=3.879 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, KAM_BADIPHTTP=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-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-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id Lnxk-C8Aj8Lw for ; Sun, 20 Nov 2016 15:02:45 +0000 (UTC) Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 763875FC4A for ; Sun, 20 Nov 2016 15:02:44 +0000 (UTC) Received: by mail-wm0-f42.google.com with SMTP id g23so108047783wme.1 for ; Sun, 20 Nov 2016 07:02:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=8PBGFKU5tttpWTlpjq0Yyg8Pt6itVHmcid2qXji7AOE=; b=Qvf5+uxGfchr5H+Z2Jk/9Fj67akJNpiy1fXKKdB8R4JZpC2lzS4Xg2NKQt2cUv7X3F /WQHc9rD6pzpGNDsBFx3M8YlED/jnZzm6y0+pw5Fuo97EoHwFWNn1ngGv2jXSXNrdJFe HjG6vqJS0/WvrpExXT0GSQnCv7Tl4u0zdxXBcdqricHKtmvurB1nhVhCyvQPdmw7sV/7 407JPIumsTlsXHMBPc3FClFXhVFzY0pSgVKx4joMdNlcoUqqASZGgo7D1ACjD16fGHst fA8N4iQUe2QcLQXqYoSsRprf1tbAv4VXm0RvZLaWD1ifjCtpUeEzUWtFpd6zGtR2yuC3 ZLag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=8PBGFKU5tttpWTlpjq0Yyg8Pt6itVHmcid2qXji7AOE=; b=UhRfn5rf8ljQ7ON+hqfOc9mdOJ5Q5VCx6MEPvAmQ9nSwoV7PgNkkxUNciH0Wknv2AB kjcquctqy6me8lBsNkkkpCuXFMQIXJVYb6NWd5rFQkjum8GWiMtTz9MiVzpNZftKKuMC iTG9CQE/8ectYn5EXqQJRWg2lqcz3OaUHMVNL3bmbtxxKTkIDZgMaJ0y0igLmjYwwoBU le1z6quzi424LEyjyx/hqARct2WJWnsiE9O41uLRBp8NGggvuOBneEY42Xp436nU3N1D A26dmLiyqztMGPQ/e50OiCvW3YTV569+TUlL/XytthimPOF3HMR1xVCFIrY4Yrs6e9vK yH9g== X-Gm-Message-State: AKaTC02rZu63XDeNq0FRlWfoHtNhpi/9TtzkPV6GuOsPnrmag1+3K+BAJ0TBDaNVKR2qIBmcO5QxSZ3QnbEjRw== X-Received: by 10.28.17.213 with SMTP id 204mr9306192wmr.17.1479654156946; Sun, 20 Nov 2016 07:02:36 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.20.193 with HTTP; Sun, 20 Nov 2016 07:02:36 -0800 (PST) In-Reply-To: <49355de5-a04b-3f97-9be3-acb064621cf3@gmail.com> References: <49355de5-a04b-3f97-9be3-acb064621cf3@gmail.com> From: Guillaume Laforge Date: Sun, 20 Nov 2016 16:02:36 +0100 Message-ID: Subject: Re: HTTPBuilder & URIBuilder - plus sign will not encoded To: users@groovy.apache.org Content-Type: multipart/alternative; boundary=001a1145aa786aa4b00541bcd407 archived-at: Sun, 20 Nov 2016 15:02:50 -0000 --001a1145aa786aa4b00541bcd407 Content-Type: text/plain; charset=UTF-8 I didn't know about NG, David! These days, I tend to use groovy wslite: https://github.com/jwagenleitner/groovy-wslite What are the pros & cons of http-builder-ng and wslite? On Sun, Nov 20, 2016 at 3:39 PM, David Clark wrote: > Plus sign is legal in URI's so they don't need to get encoded to be legal: > > http://stackoverflow.com/questions/1547899/which- > characters-make-a-url-invalid/1547940#1547940 > This is complicated by the fact that they are url encoded when part of the > query string, but that's not what you are doing here. It sounds to me like > the problem is on the server or there some other part of your request that > is incorrect. > > If there is a problem inside HTTPBuilder, you are probably out of luck, > that project has been dead for a while. > > However, I have created a successor to HTTPBuilder called http-builder-ng > that is active here: > > https://github.com/dwclark/http-builder-ng > > It is NOT a backwards compatible upgrade. When I was examining the > original source code I found many threading issues, code duplication, it > was imposible to use @TypeChecked/@CompileStatic, and found it hard to > integrated different clients inside HTTPBuilder. The result of these > frustrations was a ground up re-write. Bug reports/pull requests are > encouraged. > > > > On 11/20/2016 07:25 AM, Christian Lotz wrote: > > Hi all, > I try to upload files via HTTPBuilder (Groovy Version: 2.4.7 JVM: 1.8.0_40 > Vendor: Oracle Corporation OS: Mac OS X). After a couple of test I > realized, that filenames containing a plus sign ("+") can't be uploaded. > The REST Service responds with HTTP/1.1 400 Bad Request. After some more > debugging I think these filenames will not get encoded correctly: > > uri.path = "/rest/" + objectNamespace + "/" + objectFile.name > > groovyx.net.http.HTTPBuilder doRequest > FINE: PUT http://172.16.29.10/rest/TEST/s*pace%20space.doc* - Filename: > space\ space.doc - OK > > groovyx.net.http.HTTPBuilder doRequest > FINE: PUT http://172.16.29.10/rest/TEST/*plus+plus.doc* -Filename > plus+plus.doc - ERROR > > All other "special" characters like spaces, #, &, % or ? will get encoded > correctly ... > > Does anybody know how to resolve this issue? > > Thanks in advance > Paolo > > > -- Guillaume Laforge Apache Groovy committer & PMC Vice-President Developer Advocate @ Google Cloud Platform Blog: http://glaforge.appspot.com/ Social: @glaforge / Google+ --001a1145aa786aa4b00541bcd407 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I didn't know about NG, David!

Thes= e days, I tend to use groovy wslite:

What are the pros & cons of http-bu= ilder-ng and wslite?

On Sun, Nov 20, 2016 at 3:39 PM, David Clark <ploti= nussmith@gmail.com> wrote:
=20 =20 =20

Plus sign is legal in URI's so they don't need to get encode= d to be legal:

http://stackoverflow.com/questions= /1547899/which-characters-make-a-url-invalid/1547940#1547940<= br>

This is complicated by the fact that they are url encoded when part of the query string, but that's not what you are doing here. It sounds to me like the problem is on the server or there some other part of your request that is incorrect.

If there is a problem inside HTTPBuilder, you are probably out of luck, that project has been dead for a while.

However, I have created a successor to HTTPBuilder called http-builder-ng that is active here:

https://github.com/= dwclark/http-builder-ng

It is NOT a backwards compatible upgrade. When I was examining the original source code I found many threading issues, code duplication, it was imposible to use @TypeChecked/@CompileStatic, and found it hard to integrated different clients inside HTTPBuilder. The result of these frustrations was a ground up re-write. Bug reports/pull requests are encouraged.



On 11/20/2016 07:2= 5 AM, Christian Lotz wrote:
Hi all,
I try to=C2=A0upload=C2=A0files via HTTPBuilder (Groovy Version: 2.4.7 JVM: 1.8.0_40 Vendor: Oracle Corporation OS: Mac OS X). After a couple of test I realized, that filenames=C2=A0containing a plus sign ("+= ") can't be uploaded. The REST Service responds with=C2=A0HT= TP/1.1 400 Bad Request. After some more debugging I think=C2=A0these filenames will not get encoded correctly:
=C2=A0
uri.path =3D "/rest/" + objectNamespace + "/" + objectFile.name

groovyx.net.http.HTTPBuilder doRequest
FINE: PUT http://1= 72.16.29.10/rest/TEST/space%20space.doc - Filename: space\ space.doc - OK

groovyx.net.http.HTTPBuilder doRequest
FINE: PUT http://17= 2.16.29.10/rest/TEST/plus+plus.doc -Filename plus+plus.doc - ERROR

=C2=A0
All other "special" characters like spaces, #, &, % or ? will get=C2=A0encoded correctly ... =
=C2=A0
Does anybody know how to resolve this issue?
=C2=A0
Thanks in advance
Paolo




--
Guillaume Laforge
Apache Groovy committer & P= MC Vice-President
Developer Advocate @ Google Cloud P= latform

Blog:=C2=A0http://glaforge.appspot.com/
Social:= @glaforge=C2= =A0/ Google+
=
--001a1145aa786aa4b00541bcd407--