From dev-return-14931-archive-asf-public=cust-asf.ponee.io@jmeter.apache.org Sat Aug 1 20:58:58 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mailroute1-lw-us.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with ESMTPS id 3423B180622 for ; Sat, 1 Aug 2020 22:58:58 +0200 (CEST) Received: from mail.apache.org (localhost [127.0.0.1]) by mailroute1-lw-us.apache.org (ASF Mail Server at mailroute1-lw-us.apache.org) with SMTP id 81229123422 for ; Sat, 1 Aug 2020 20:58:46 +0000 (UTC) Received: (qmail 68258 invoked by uid 500); 1 Aug 2020 20:58:46 -0000 Mailing-List: contact dev-help@jmeter.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jmeter.apache.org Delivered-To: mailing list dev@jmeter.apache.org Received: (qmail 68246 invoked by uid 99); 1 Aug 2020 20:58:46 -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; Sat, 01 Aug 2020 20:58:46 +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 5862D1A33CD for ; Sat, 1 Aug 2020 20:58:45 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.001 X-Spam-Level: X-Spam-Status: No, score=0.001 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.2, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-he-de.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 73lVS0qc_qcn for ; Sat, 1 Aug 2020 20:58:42 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::b2c; helo=mail-yb1-xb2c.google.com; envelope-from=philippe.mouawad@gmail.com; receiver= Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) by mx1-he-de.apache.org (ASF Mail Server at mx1-he-de.apache.org) with ESMTPS id CA7737F865 for ; Sat, 1 Aug 2020 20:58:41 +0000 (UTC) Received: by mail-yb1-xb2c.google.com with SMTP id 133so18120430ybu.7 for ; Sat, 01 Aug 2020 13:58:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=dMFLDu40jZqJlj0ckt3pgv2bA47GxkQIGSS+MScBq+4=; b=S7Y/fhK96IIvVjuCT4Mouh4otf5/WpQFCj+4cOKvjIQXZGPulA1C8nV1OuZDo0PkWm at3Kz/AoElLj3C8T84Tkf5pZusSnY/bB/UhTroE3U7S1jdc/hpgT9SwP3Cw5mVVovWLJ YK/Yvi0k+QWFhBgeQeTfBeK2yrPtCyVlWYEwFLFxyniR/NwTDLwOxYTUlnHTWuzQVoU+ g5tuQZQekRhkrc7RmRoDd9SmI1KLhqBh1h3osWDZ1VSgB9Zze5TUD9KyC0qPTH3Df3qD ALD3lru62/Kgg2C6lFN66bgUQuc2TiPajUIpaI5mWAg2sxSJG3mGrsFHaDLdROKMsixp OF9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=dMFLDu40jZqJlj0ckt3pgv2bA47GxkQIGSS+MScBq+4=; b=JusIDBt95WG+ONBPo4pkdyw/hQKXKBIHl1KTy9appJ5uTgHY/WJoSa98SBOuseKVF1 v6mY+WEp5dL38ARisVHRoxHxXHhGXTzLazQf1vd0w4568fpqzgd8ZwG1cp/oMqWxY1dN lW9Sq5QozKufEhws66550AYbBxZiFY0T/KhVmZCsdJpcQstzlKa9/QaCAg/9CiGPG2pZ kYmcg/Gvanpu2iuB+7ootUsDz325PbUmlbEjmYLEMd01CrLSdWgNvMPK28w4e+8gTlai Iqr4BdjbHajZsCYhrgHuPIPJ+fJbIn9iUxJBuE0h5lKXSyDwVyVV66Mw8BnVEiWTLAcO kYtw== X-Gm-Message-State: AOAM533SGbpYr10NRZ3M1FV1a227FlJCGeEznMZx6YN00NLdi5DE85an V1X5RZMRME48aImde6W+mssvdqFOqBz/tTtLbwKeOA== X-Google-Smtp-Source: ABdhPJzvXA8QM3dImhFqBa3drf6DnxjScvX3sNhw31LVDNl/R1dF9VDrCk3abDC1Ge7Hn/FzAYs2biCtsA4yvGgOqzk= X-Received: by 2002:a25:7455:: with SMTP id p82mr14705465ybc.287.1596315520178; Sat, 01 Aug 2020 13:58:40 -0700 (PDT) MIME-Version: 1.0 References: <159169980416.23893.11862037394922372313@gitbox.apache.org> In-Reply-To: <159169980416.23893.11862037394922372313@gitbox.apache.org> From: Philippe Mouawad Date: Sat, 1 Aug 2020 22:58:35 +0200 Message-ID: Subject: Re: [jmeter] branch master updated: Better parse curl commands with backslash at line endings and support PUT method with data arguments To: ApacheJMeter dev list Content-Type: multipart/alternative; boundary="000000000000879cbe05abd72b2a" --000000000000879cbe05abd72b2a Content-Type: text/plain; charset="UTF-8" Hello Felix, Sorry for noticing this a bit late. See my remark inline below. Maybe I misunderstand the fix. Thanks Regards On Tue, Jun 9, 2020 at 12:50 PM wrote: > This is an automated email from the ASF dual-hosted git repository. > > fschumacher pushed a commit to branch master > in repository https://gitbox.apache.org/repos/asf/jmeter.git > > > The following commit(s) were added to refs/heads/master by this push: > new 353ad79 Better parse curl commands with backslash at line > endings and support PUT method with data arguments > 353ad79 is described below > > commit 353ad79c5497c4d624f8b276580b6b50d45b27b9 > Author: Felix Schumacher > AuthorDate: Tue Jun 9 12:49:00 2020 +0200 > > Better parse curl commands with backslash at line endings and support > PUT method with data arguments > > Bugzilla Id: 64446 > --- > .../jmeter/protocol/http/curl/BasicCurlParser.java | 6 ++++-- > .../org/apache/jmeter/curl/BasicCurlParserTest.java | 19 > +++++++++++++++++++ > xdocs/changes.xml | 1 + > 3 files changed, 24 insertions(+), 2 deletions(-) > > diff --git > a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/curl/BasicCurlParser.java > b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/curl/BasicCurlParser.java > index 0c7fcd6..8d95da2 100644 > --- > a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/curl/BasicCurlParser.java > +++ > b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/curl/BasicCurlParser.java > @@ -700,7 +700,9 @@ public class BasicCurlParser { > String value = option.getArgument(0); > String dataOptionName = > option.getDescriptor().getName(); > value = getPostDataByDifferentOption(value.trim(), > dataOptionName); > - request.setMethod("POST"); > + if ("GET".equals(request.getMethod())) { > + request.setMethod("POST"); > + } > Isn't it weird to transform a GET into a POST ? Get with body data is possible in JMeter request.setPostData(value); > } else if > (FORMS_OPT.contains(option.getDescriptor().getId())) { > String nameAndValue = option.getArgument(0); > @@ -850,7 +852,7 @@ public class BasicCurlParser { > current.setLength(0); > } > } else { > - current.append(nextTok); > + current.append(nextTok.replaceAll("^\\\\[\\r\\n]", > "")); > } > lastTokenHasBeenQuoted = false; > break; > diff --git > a/src/protocol/http/src/test/java/org/apache/jmeter/curl/BasicCurlParserTest.java > b/src/protocol/http/src/test/java/org/apache/jmeter/curl/BasicCurlParserTest.java > index 39f003b..c9f9228 100644 > --- > a/src/protocol/http/src/test/java/org/apache/jmeter/curl/BasicCurlParserTest.java > +++ > b/src/protocol/http/src/test/java/org/apache/jmeter/curl/BasicCurlParserTest.java > @@ -89,6 +89,25 @@ public class BasicCurlParserTest { > } > > @Test > + public void testBackslashAtLineEnding() { > + String cmdLine = "curl \\\n-d 'hey' http://jmeter.apache.org/"; > + BasicCurlParser basicCurlParser = new BasicCurlParser(); > + BasicCurlParser.Request request = basicCurlParser.parse(cmdLine); > + assertEquals("http://jmeter.apache.org/", request.getUrl()); > + assertEquals("hey", request.getPostData()); > + } > + > + @Test > + public void testSetRequestMethodOnData() { > + String cmdLine = "curl -X PUT -d 'hey' http://jmeter.apache.org/ > "; > + BasicCurlParser basicCurlParser = new BasicCurlParser(); > + BasicCurlParser.Request request = basicCurlParser.parse(cmdLine); > + assertEquals("http://jmeter.apache.org/", request.getUrl()); > + assertEquals("hey", request.getPostData()); > + assertEquals("PUT", request.getMethod()); > + } > + > + @Test > public void testChromeParsingNotCompressed() { > String cmdLine = "curl 'https://jmeter.apache.org/' -H > 'Proxy-Connection: keep-alive' " > + "-H 'Proxy-Authorization: Basic XXXXXXXXX/' -H > 'Upgrade-Insecure-Requests: 1' " > diff --git a/xdocs/changes.xml b/xdocs/changes.xml > index f2c8db3..0772b9a 100644 > --- a/xdocs/changes.xml > +++ b/xdocs/changes.xml > @@ -109,6 +109,7 @@ Summary > >

General

>
    > +
  • 64446Better parse curl commands with backslash at line > endings and support PUT method with data arguments
  • >
> > Non-functional changes > > -- Cordialement. Philippe Mouawad. --000000000000879cbe05abd72b2a--