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 64C2A200B20 for ; Wed, 11 May 2016 23:25:59 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 635DB160A18; Wed, 11 May 2016 21:25:59 +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 87F85160A17 for ; Wed, 11 May 2016 23:25:58 +0200 (CEST) Received: (qmail 58902 invoked by uid 500); 11 May 2016 21:25:57 -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 58890 invoked by uid 99); 11 May 2016 21:25:57 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 May 2016 21:25:57 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 148BCC3B05 for ; Wed, 11 May 2016 21:25:57 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.198 X-Spam-Level: * X-Spam-Status: No, score=1.198 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_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-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 (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id HZm4mw8ujh7W for ; Wed, 11 May 2016 21:25:56 +0000 (UTC) Received: from mail-qg0-f52.google.com (mail-qg0-f52.google.com [209.85.192.52]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 22C5D5F1E3 for ; Wed, 11 May 2016 21:25:55 +0000 (UTC) Received: by mail-qg0-f52.google.com with SMTP id w36so31490790qge.3 for ; Wed, 11 May 2016 14:25:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=pHXNiUb486uKVrlrDSEf8ettxXQj5uHnddgK54cVnUw=; b=0zywirL90yrUKE7/CPZzs9tVihs0Lzeui84x4+ymZNVDRgeXAFiguC4REeDvHLtwR6 CI1hHFvXMr9gzSDh+N9gp7k2H4GseLkYYUWGPsKAFfMhChI37DntQVAnUhsyh72oQ/3C TBJ0sLJAhnLynxp77G6q1896Wjr4Mwg1i8NGacf88o5/yY+9QdLeeNOJwP05c+cphPqb VmRVY3PzvA7hf4Q/kmrjgQTF212kbvsNMPkJqxiIk0zejwTfvC+YLglA9LJAqgDgGSOf DWfzHZvO/Y5XkW4/JwIxKczGUL/xMraABMqWma6A+0wdOBQmsjEArYowySGkh1RklTcV /9RQ== 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:date :message-id:subject:from:to; bh=pHXNiUb486uKVrlrDSEf8ettxXQj5uHnddgK54cVnUw=; b=WOhsEpFJ92GReFauq2IbluaKNv4h4y5C/xGEMiiL1JyRJFpflYN6H2T52dpvvrTOj/ Z75cnVWJ08bMflR5tJjoe/P1ASowry9KvpEX69uX4ABrkOQfFdD5P0nQc+WiPvQUIMMy lkdkQ4qcIiU01Z/v13e2OZsP19JFii40fjM3OmIxR4az0R3p8Gkc6n9QWA1BCOiSDPLn 4JGVIoAGFKSafJrSO99vz+rYPIYYm5a97JjQG/3GM79aexK4wsc2arM+CtCG7BOanUrk IH5ngdZMoo5meShu8A2BvJAlFdkIqtahtvR8/sW3USFLmG/dHLhSc+6rplHO7wi9k/ir hXlQ== X-Gm-Message-State: AOPr4FVBh2z2F51gtFJoOGORbbXhdC83BVHGip2XkNdZtq5Pw2H6NZv64FcaqM3iGkACf4dIFtUpaW98Rn6zew== MIME-Version: 1.0 X-Received: by 10.140.131.81 with SMTP id 78mr6253051qhd.34.1463001954300; Wed, 11 May 2016 14:25:54 -0700 (PDT) Received: by 10.55.160.77 with HTTP; Wed, 11 May 2016 14:25:54 -0700 (PDT) In-Reply-To: References: <20160511210901.609FF3A0046@svn01-us-west.apache.org> Date: Wed, 11 May 2016 23:25:54 +0200 Message-ID: Subject: Re: svn commit: r1743429 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java From: Philippe Mouawad To: "dev@jmeter.apache.org" Content-Type: multipart/alternative; boundary=001a11c07ca4cac7b9053297afb8 archived-at: Wed, 11 May 2016 21:25:59 -0000 --001a11c07ca4cac7b9053297afb8 Content-Type: text/plain; charset=UTF-8 thanks for review. Feel free to commit the fix On Wednesday, May 11, 2016, sebb wrote: > On 11 May 2016 at 22:09, > wrote: > > Author: pmouawad > > Date: Wed May 11 21:09:00 2016 > > New Revision: 1743429 > > > > URL: http://svn.apache.org/viewvc?rev=1743429&view=rev > > Log: > > Bug 59489 - Regression in JMeter 3.0 : Compressed responses break > keepalive management > > Bugzilla Id: 59489 > > > > Modified: > > > jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java > > > > Modified: > jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java > > URL: > http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java?rev=1743429&r1=1743428&r2=1743429&view=diff > > > ============================================================================== > > --- > jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java > (original) > > +++ > jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java > Wed May 11 21:09:00 2016 > > @@ -186,10 +186,6 @@ public class HTTPHC4Impl extends HTTPHCA > > } > > }; > > > > - /** > > - * Attribute name used to store headers in {@link BasicHttpContext} > > - */ > > - private static final String JMETER_RESPONSE_BACKUP_HEADERS = > "__jmeter.RESPONSE_BACKUP_HEADERS"; > > > > /** > > * Headers to save > > @@ -209,8 +205,8 @@ public class HTTPHC4Impl extends HTTPHCA > > @Override > > public void process(HttpResponse response, HttpContext context) > > throws HttpException, IOException { > > + ArrayList headersToSave = new ArrayList<>(3); > > > > - context.removeAttribute(JMETER_RESPONSE_BACKUP_HEADERS); > > final HttpEntity entity = response.getEntity(); > > final HttpClientContext clientContext = > HttpClientContext.adapt(context); > > final RequestConfig requestConfig = > clientContext.getRequestConfig(); > > @@ -218,17 +214,21 @@ public class HTTPHC4Impl extends HTTPHCA > > if (requestConfig.isContentCompressionEnabled() && entity > != null && entity.getContentLength() != 0) { > > final Header ceheader = entity.getContentEncoding(); > > if (ceheader != null) { > > - ArrayList headersToSave = new > ArrayList<>(3); > > for(String name : HEADERS_TO_SAVE) { > > Header[] hdr = response.getHeaders(name); // > empty if none > > headersToSave.add(hdr); > > } > > - context.setAttribute(JMETER_RESPONSE_BACKUP_HEADERS, > headersToSave); > > } > > } > > > > // Now invoke original parent code > > super.process(response, clientContext); > > + // Should this be in a finally ? > > + for (Header[] headers : headersToSave) { > > + for (Header headerToRestore : headers) { > > + response.addHeader(headerToRestore); > > That can result in header duplication. See below. > > > + } > > + } > > } > > }; > > > > @@ -953,18 +953,6 @@ public class HTTPHC4Impl extends HTTPHCA > > for (Header responseHeader : rh) { > > writeResponseHeader(headerBuf, responseHeader); > > } > > - List backupHeaders = (List) > localContext.getAttribute(JMETER_RESPONSE_BACKUP_HEADERS); > > - if(backupHeaders != null) { > > - for (Header[] headers : backupHeaders) { > > - for (Header responseHeader: headers) { > > - if > (response.containsHeader(responseHeader.getName())) { > > - break; // it was not deleted, so don't store it > again > > Note that the original fix checks whether or not to restore the header. > > > - } > > - writeResponseHeader(headerBuf, responseHeader); > > - } > > - } > > - } > > - > > return headerBuf.toString(); > > } > > > > > > > -- Cordialement. Philippe Mouawad. --001a11c07ca4cac7b9053297afb8--