You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by ubikloadpack <gi...@git.apache.org> on 2017/11/05 22:16:04 UTC
[GitHub] jmeter pull request #320: HTTPClient 4.5. migration to last APIs / Bugzilla ...
GitHub user ubikloadpack opened a pull request:
https://github.com/apache/jmeter/pull/320
HTTPClient 4.5. migration to last APIs / Bugzilla 58757 & 61664
Hello,
Find in this PR the migration to last HC4 APIs and the fix of Digest Auth that was only partially implemented.
This PR fixes:
- https://bz.apache.org/bugzilla/show_bug.cgi?id=61664
- https://bz.apache.org/bugzilla/show_bug.cgi?id=58757
Regards
Philippe M.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/ubikloadpack/jmeter HC4_FULL_MIGRATION
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/jmeter/pull/320.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #320
----
commit 702c8308c2b2db3152e4ef7c1c35747bc686fdf0
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-10-09T21:20:26Z
Migration
commit 1e120df142c2380fdf52298dba9301261907186d
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-10-12T08:32:36Z
Remove deprecated use of VIRTUAL_HOST
commit 92bdafa0e7ba197670f3f278113ff559e29e16ee
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-10-13T19:29:59Z
Migrate Slow Socket feature to new APIs
commit e179a7c17e3c094f3b17436cbf74b360df64a288
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-10-13T19:53:37Z
Use non deprecated constructor in ViewableFileBody
Drop call to
post.getParams().setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET,
contentEncoding);
commit f30b574dfe53b6cfb6157877e56669db41eafdb7
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-10-13T19:55:00Z
Merge remote-tracking branch 'upstream/trunk' into HC4_FULL_MIGRATION
commit b1773d9ee3d7444071cd88b02a6170365cbd1b47
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-10-13T22:22:06Z
Implement LazyLayeredConnectionSocketFactory
Migrate Bandwidth measurement
commit 3910c2a8630d0b928d9c61f53a6934eee532ca45
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-10-14T20:28:15Z
Adapt test cases after migration to HC4.5.x new APIs
commit f7164b7cfcdb6158493b8c789f55147c39755557
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-10-27T19:56:22Z
Temp code
commit b27bb3caf8f189938c5f8d322df7570d81f0ae79
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-10-27T20:02:36Z
Merge current trunk
commit c6cc9d86df139c4d635547d272ec45457528ff74
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-10-28T22:30:24Z
Merge remote-tracking branch 'upstream/trunk' into HC4_FULL_MIGRATION
commit e6d18781bf04d3bc02fe1291e2376356626a8fd3
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-10-28T22:31:23Z
Add Basic and Digest preemptive auth
commit 4b25ac3c49e064b3508ed1ff443ef1ae23bde89b
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-10-29T09:14:49Z
Sonar cleanups, upgrade ViewableFileBody
commit e2f4c72ed411059564fac94561e6a32a493a382e
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-10-30T17:32:35Z
Fix logger
commit 799d65f6fdf2d074ea46fa10523fc8ac2605cd77
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-10-30T17:32:55Z
Deprecate classes
commit 713474625d8f81b1dfa5a3a76c03844e05935e54
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-10-30T17:33:10Z
Deprecate classes
commit e6293b3267cca306fda060bbdf7e852e387d3f8f
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-10-30T17:35:06Z
Some refactoring
Plugin Proxy Auth
Start Kerberos
commit 96e60fcaff96ac145a828b79190ac2ced1b56048
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-11-04T14:19:29Z
Merge remote-tracking branch 'upstream/trunk' into HC4_FULL_MIGRATION
commit 5e9df36d9ce869eacd99784e79a9e6131892d045
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-11-05T08:42:37Z
Merge remote-tracking branch 'upstream/trunk' into HC4_FULL_MIGRATION
commit d929454a9917565582bc4a361d5095c90a4911ef
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-11-05T08:47:42Z
Complete Kerberos
Use constants
commit e02e8fa64d364e64a1c081e207567d02e975fbf5
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-11-05T08:48:53Z
Complete Kerberos
Use constants
commit 42699f997cfbd1287fff64be77991e3c6e790fbc
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-11-05T11:58:10Z
Fix wrong default
commit 9f710d9f9840b547dc9a1fd93c2ea9420c18c2a8
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-11-05T14:24:22Z
Finalize
commit 234b21fd480daf07cef1e6fc8729bede60e493cb
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-11-05T20:17:53Z
Merge remote-tracking branch 'upstream/trunk' into HC4_FULL_MIGRATION
commit bbfef0eff48a771f7b4db892d959c6e0008882c9
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-11-05T22:07:36Z
Improve logging
commit c8c2d9b53b863aa3285d366dd473c3851af36d79
Author: pmouawad <p....@ubik-ingenierie.com>
Date: 2017-11-05T22:07:53Z
Remove useless code
----
---
[GitHub] jmeter pull request #320: HTTPClient 4.5. migration to last APIs / Bugzilla ...
Posted by ubikloadpack <gi...@git.apache.org>.
Github user ubikloadpack closed the pull request at:
https://github.com/apache/jmeter/pull/320
---
[GitHub] jmeter issue #320: HTTPClient 4.5. migration to last APIs / Bugzilla 58757 &...
Posted by codecov-io <gi...@git.apache.org>.
Github user codecov-io commented on the issue:
https://github.com/apache/jmeter/pull/320
# [Codecov](https://codecov.io/gh/apache/jmeter/pull/320?src=pr&el=h1) Report
> Merging [#320](https://codecov.io/gh/apache/jmeter/pull/320?src=pr&el=desc) into [trunk](https://codecov.io/gh/apache/jmeter/commit/b0f89d7e402407e2d09bd22ddd994f4a85caede3?src=pr&el=desc) will **decrease** coverage by `0.35%`.
> The diff coverage is `67.78%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/jmeter/pull/320/graphs/tree.svg?width=650&height=150&token=6Q7CI1wFSh&src=pr)](https://codecov.io/gh/apache/jmeter/pull/320?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## trunk #320 +/- ##
============================================
- Coverage 57.73% 57.38% -0.36%
+ Complexity 9892 9811 -81
============================================
Files 1136 1139 +3
Lines 72913 73011 +98
Branches 7300 7309 +9
============================================
- Hits 42095 41895 -200
- Misses 28347 28663 +316
+ Partials 2471 2453 -18
```
| [Impacted Files](https://codecov.io/gh/apache/jmeter/pull/320?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...l/http/sampler/JMeterClientConnectionOperator.java](https://codecov.io/gh/apache/jmeter/pull/320?src=pr&el=tree#diff-c3JjL3Byb3RvY29sL2h0dHAvb3JnL2FwYWNoZS9qbWV0ZXIvcHJvdG9jb2wvaHR0cC9zYW1wbGVyL0pNZXRlckNsaWVudENvbm5lY3Rpb25PcGVyYXRvci5qYXZh) | `0% <ø> (-81.82%)` | `0 <0> (-2)` | |
| [.../jmeter/protocol/http/sampler/hc/HttpConnPool.java](https://codecov.io/gh/apache/jmeter/pull/320?src=pr&el=tree#diff-c3JjL3Byb3RvY29sL2h0dHAvb3JnL2FwYWNoZS9qbWV0ZXIvcHJvdG9jb2wvaHR0cC9zYW1wbGVyL2hjL0h0dHBDb25uUG9vbC5qYXZh) | `0% <ø> (-100%)` | `0 <0> (-3)` | |
| [...rotocol/http/util/HC4TrustAllSSLSocketFactory.java](https://codecov.io/gh/apache/jmeter/pull/320?src=pr&el=tree#diff-c3JjL3Byb3RvY29sL2h0dHAvb3JnL2FwYWNoZS9qbWV0ZXIvcHJvdG9jb2wvaHR0cC91dGlsL0hDNFRydXN0QWxsU1NMU29ja2V0RmFjdG9yeS5qYXZh) | `0% <ø> (-63.64%)` | `0 <0> (-4)` | |
| [...l/http/sampler/hc/ManagedClientConnectionImpl.java](https://codecov.io/gh/apache/jmeter/pull/320?src=pr&el=tree#diff-c3JjL3Byb3RvY29sL2h0dHAvb3JnL2FwYWNoZS9qbWV0ZXIvcHJvdG9jb2wvaHR0cC9zYW1wbGVyL2hjL01hbmFnZWRDbGllbnRDb25uZWN0aW9uSW1wbC5qYXZh) | `0% <ø> (-43.78%)` | `0 <0> (-28)` | |
| [...jmeter/protocol/http/sampler/hc/HttpPoolEntry.java](https://codecov.io/gh/apache/jmeter/pull/320?src=pr&el=tree#diff-c3JjL3Byb3RvY29sL2h0dHAvb3JnL2FwYWNoZS9qbWV0ZXIvcHJvdG9jb2wvaHR0cC9zYW1wbGVyL2hjL0h0dHBQb29sRW50cnkuamF2YQ==) | `0% <ø> (-73.69%)` | `0 <0> (-8)` | |
| [...protocol/http/sampler/LazySchemeSocketFactory.java](https://codecov.io/gh/apache/jmeter/pull/320?src=pr&el=tree#diff-c3JjL3Byb3RvY29sL2h0dHAvb3JnL2FwYWNoZS9qbWV0ZXIvcHJvdG9jb2wvaHR0cC9zYW1wbGVyL0xhenlTY2hlbWVTb2NrZXRGYWN0b3J5LmphdmE=) | `0% <ø> (-66.67%)` | `0 <0> (-5)` | |
| [...mpler/hc/JMeterPoolingClientConnectionManager.java](https://codecov.io/gh/apache/jmeter/pull/320?src=pr&el=tree#diff-c3JjL3Byb3RvY29sL2h0dHAvb3JnL2FwYWNoZS9qbWV0ZXIvcHJvdG9jb2wvaHR0cC9zYW1wbGVyL2hjL0pNZXRlclBvb2xpbmdDbGllbnRDb25uZWN0aW9uTWFuYWdlci5qYXZh) | `0% <ø> (-30.96%)` | `0 <0> (-11)` | |
| [...ocol/http/sampler/HttpClientDefaultParameters.java](https://codecov.io/gh/apache/jmeter/pull/320?src=pr&el=tree#diff-c3JjL3Byb3RvY29sL2h0dHAvb3JnL2FwYWNoZS9qbWV0ZXIvcHJvdG9jb2wvaHR0cC9zYW1wbGVyL0h0dHBDbGllbnREZWZhdWx0UGFyYW1ldGVycy5qYXZh) | `0% <ø> (ø)` | `0 <0> (ø)` | :arrow_down: |
| [...meter/protocol/http/util/SlowHC4SocketFactory.java](https://codecov.io/gh/apache/jmeter/pull/320?src=pr&el=tree#diff-c3JjL3Byb3RvY29sL2h0dHAvb3JnL2FwYWNoZS9qbWV0ZXIvcHJvdG9jb2wvaHR0cC91dGlsL1Nsb3dIQzRTb2NrZXRGYWN0b3J5LmphdmE=) | `0% <ø> (-80%)` | `0 <0> (-2)` | |
| [...tocol/http/sampler/MeasuringConnectionManager.java](https://codecov.io/gh/apache/jmeter/pull/320?src=pr&el=tree#diff-c3JjL3Byb3RvY29sL2h0dHAvb3JnL2FwYWNoZS9qbWV0ZXIvcHJvdG9jb2wvaHR0cC9zYW1wbGVyL01lYXN1cmluZ0Nvbm5lY3Rpb25NYW5hZ2VyLmphdmE=) | `0% <0%> (-64.39%)` | `0 <0> (-3)` | |
| ... and [27 more](https://codecov.io/gh/apache/jmeter/pull/320?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/jmeter/pull/320?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/jmeter/pull/320?src=pr&el=footer). Last update [b0f89d7...53e2934](https://codecov.io/gh/apache/jmeter/pull/320?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
---
[GitHub] jmeter pull request #320: HTTPClient 4.5. migration to last APIs / Bugzilla ...
Posted by ham1 <gi...@git.apache.org>.
Github user ham1 commented on a diff in the pull request:
https://github.com/apache/jmeter/pull/320#discussion_r150891784
--- Diff: src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java ---
@@ -97,10 +94,33 @@
private static final boolean DEFAULT_CLEAR_VALUE = false;
/** Decides whether port should be omitted from SPN for kerberos spnego authentication */
- private static final boolean STRIP_PORT = JMeterUtils.getPropDefault("kerberos.spnego.strip_port", true);
+ public static final boolean STRIP_PORT = JMeterUtils.getPropDefault("kerberos.spnego.strip_port", true);
+
+ /** Decides whether port should be omitted from SPN for kerberos spnego authentication */
+ public static final boolean USE_CANONICAL_HOST_NAME = JMeterUtils.getPropDefault("kerberos.spnego.use_canonical_host_name", true);
public enum Mechanism {
- BASIC_DIGEST, KERBEROS
+ /**
+ * @deprecated (use {@link Mechanism#BASIC})
+ */
+ @Deprecated
+ BASIC_DIGEST,
+ /**
+ * Basic Auth
+ */
+ BASIC,
+ /**
+ * Digest Auth
+ */
+ DIGEST,
+ /**
+ * Kerberos Auth
+ */
+ KERBEROS
+ }
+
+ public static void main(String[] args) {
+ System.out.println(Mechanism.values());
--- End diff --
Should this be here?
---
[GitHub] jmeter pull request #320: HTTPClient 4.5. migration to last APIs / Bugzilla ...
Posted by ham1 <gi...@git.apache.org>.
Github user ham1 commented on a diff in the pull request:
https://github.com/apache/jmeter/pull/320#discussion_r150891448
--- Diff: src/protocol/http/org/apache/jmeter/protocol/http/api/auth/DigestParameters.java ---
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jmeter.protocol.http.api.auth;
+
+/**
+ * Allows digest customization
+ * @since 4.0
+ */
+public class DigestParameters {
+ public static final String VARIABLE_NAME = "__jmeter_DP__";
+ private String qop;
+ private String nonce;
+ private String charset;
+ private String algorithm;
+ private String opaque;
+ /**
+ *
--- End diff --
I think this class would be better without any of the JavaDoc comments, they do not add anything because the class is so simple there's nothing which needs commenting.
---
[GitHub] jmeter issue #320: HTTPClient 4.5. migration to last APIs / Bugzilla 58757 &...
Posted by pmouawad <gi...@git.apache.org>.
Github user pmouawad commented on the issue:
https://github.com/apache/jmeter/pull/320
Merged:
- http://svn.apache.org/viewvc?rev=1825269&view=rev
---
[GitHub] jmeter pull request #320: HTTPClient 4.5. migration to last APIs / Bugzilla ...
Posted by ham1 <gi...@git.apache.org>.
Github user ham1 commented on a diff in the pull request:
https://github.com/apache/jmeter/pull/320#discussion_r150905177
--- Diff: src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java ---
@@ -215,22 +269,128 @@ public long getKeepAliveDuration(HttpResponse response, HttpContext context) {
};
- /**
- * Special interceptor made to keep metrics when connection is released for some method like HEAD
- * Otherwise calling directly ((HttpConnection) localContext.getAttribute(HttpCoreContext.HTTP_CONNECTION)).getMetrics();
- * would throw org.apache.http.impl.conn.ConnectionShutdownException
- * See <a href="https://bz.apache.org/jira/browse/HTTPCLIENT-1081">HTTPCLIENT-1081</a>
- */
- private static final HttpResponseInterceptor METRICS_SAVER = (HttpResponse response, HttpContext context) -> {
- HttpConnectionMetrics metrics = ((HttpConnection) context.getAttribute(HttpCoreContext.HTTP_CONNECTION)).getMetrics();
- context.setAttribute(CONTEXT_METRICS, metrics);
- };
- private static final HttpRequestInterceptor METRICS_RESETTER = (HttpRequest request, HttpContext context) -> {
- HttpConnectionMetrics metrics = ((HttpConnection) context.getAttribute(HttpCoreContext.HTTP_CONNECTION)).getMetrics();
- metrics.reset();
+ private static final String DIGEST_PARAMETERS = DigestParameters.VARIABLE_NAME;
+
+
+ private static final HttpRequestInterceptor PREEMPTIVE_AUTH_INTERCEPTOR = new HttpRequestInterceptor() {
--- End diff --
This is almost 100 lines and with lots of nesting becomes very hard to read and review, could it be split into smaller methods?
---
[GitHub] jmeter pull request #320: HTTPClient 4.5. migration to last APIs / Bugzilla ...
Posted by ham1 <gi...@git.apache.org>.
Github user ham1 commented on a diff in the pull request:
https://github.com/apache/jmeter/pull/320#discussion_r150895140
--- Diff: src/protocol/http/org/apache/jmeter/protocol/http/control/DynamicKerberosSchemeFactory.java ---
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jmeter.protocol.http.control;
+
+import org.apache.http.auth.AuthScheme;
+import org.apache.http.impl.auth.KerberosScheme;
+import org.apache.http.impl.auth.KerberosSchemeFactory;
+import org.apache.http.protocol.HttpContext;
+
+/**
+ * Extends {@link KerberosSchemeFactory} to provide ability to customize stripPort
+ * setting in {@link KerberosScheme} based on {@link HttpContext}
+ */
+public class DynamicKerberosSchemeFactory extends KerberosSchemeFactory {
+ static final String CONTEXT_ATTRIBUTE_STRIP_PORT = "__jmeter.K_SP__";
+
+ /**
+ * @since 4.0
+ */
+ public DynamicKerberosSchemeFactory(final boolean stripPort, final boolean useCanonicalHostname) {
+ super(stripPort, useCanonicalHostname);
+ }
+
+ @Override
+ public AuthScheme create(final HttpContext context) {
+ Boolean localStripPort = (Boolean) context.getAttribute(CONTEXT_ATTRIBUTE_STRIP_PORT);
+ return new KerberosScheme(localStripPort != null ?
--- End diff --
might be better as a variable rather than a multi-line ternary operator as a parameter?
e.g.
```java
Boolean stripPort = localStripPort != null ? localStripPort : isStripPort();
return new KerberosScheme(stripPort, isUseCanonicalHostname());
```
---
[GitHub] jmeter issue #320: HTTPClient 4.5. migration to last APIs / Bugzilla 58757 &...
Posted by pmouawad <gi...@git.apache.org>.
Github user pmouawad commented on the issue:
https://github.com/apache/jmeter/pull/320
Hello,
Any feedback on this ?
Thanks
---