You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2017/05/09 20:01:27 UTC

[01/50] httpcomponents-core git commit: HTTPCORE-428: SSLIOSession#close to handle CancelledKeyException

Repository: httpcomponents-core
Updated Branches:
  refs/heads/4.4.x [created] c9810ec11


HTTPCORE-428: SSLIOSession#close to handle CancelledKeyException

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1753869 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/37c55626
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/37c55626
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/37c55626

Branch: refs/heads/4.4.x
Commit: 37c5562634e64be4b217aac65d78750b78a6aa8c
Parents: c7674cc
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Sat Jul 23 13:11:13 2016 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Sat Jul 23 13:11:13 2016 +0000

----------------------------------------------------------------------
 .../org/apache/http/nio/reactor/ssl/SSLIOSession.java    | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/37c55626/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
index dd579ab..f619155 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
@@ -32,6 +32,7 @@ import java.net.Socket;
 import java.net.SocketAddress;
 import java.nio.ByteBuffer;
 import java.nio.channels.ByteChannel;
+import java.nio.channels.CancelledKeyException;
 import java.nio.channels.ClosedChannelException;
 import java.nio.channels.SelectionKey;
 
@@ -633,7 +634,11 @@ public class SSLIOSession implements IOSession, SessionBufferStatus, SocketAcces
             this.session.setSocketTimeout(1000);
         }
         this.sslEngine.closeOutbound();
-        updateEventMask();
+        try {
+            updateEventMask();
+        } catch (CancelledKeyException ex) {
+            shutdown();
+        }
     }
 
     @Override
@@ -641,14 +646,14 @@ public class SSLIOSession implements IOSession, SessionBufferStatus, SocketAcces
         if (this.status == CLOSED) {
             return;
         }
+        this.status = CLOSED;
+        this.session.shutdown();
 
         this.inEncrypted.release();
         this.outEncrypted.release();
         this.inPlain.release();
         this.outPlain.release();
 
-        this.status = CLOSED;
-        this.session.shutdown();
     }
 
     @Override


[30/50] httpcomponents-core git commit: Less verbose.

Posted by ol...@apache.org.
Less verbose.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1792552 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/a7575851
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/a7575851
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/a7575851

Branch: refs/heads/4.4.x
Commit: a7575851eae4de1f4778deecad548da855597be0
Parents: 03a8746
Author: Gary D. Gregory <gg...@apache.org>
Authored: Mon Apr 24 21:56:07 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Mon Apr 24 21:56:07 2017 +0000

----------------------------------------------------------------------
 .../src/main/java/org/apache/http/protocol/RequestTargetHost.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/a7575851/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java b/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java
index 53f4051..2c5462a 100644
--- a/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java
+++ b/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java
@@ -85,9 +85,8 @@ public class RequestTargetHost implements HttpRequestInterceptor {
                 if (targethost == null) {
                     if (ver.lessEquals(HttpVersion.HTTP_1_0)) {
                         return;
-                    } else {
-                        throw new ProtocolException("Target host missing");
                     }
+                    throw new ProtocolException("Target host missing");
                 }
             }
             request.addHeader(HTTP.TARGET_HOST, targethost.toHostString());


[41/50] httpcomponents-core git commit: HTTPCORE-462: Deprecate SSLContextBuilder.useProtocol(String) in favor a new method setProtocol(String). Local build OK.

Posted by ol...@apache.org.
HTTPCORE-462: Deprecate SSLContextBuilder.useProtocol(String) in favor a new method setProtocol(String). Local build OK.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1794107 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/6b592d5c
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/6b592d5c
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/6b592d5c

Branch: refs/heads/4.4.x
Commit: 6b592d5c2d0f4011004bd4f473e50e1cbff70b62
Parents: 0a543bb
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri May 5 21:17:59 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri May 5 21:17:59 2017 +0000

----------------------------------------------------------------------
 RELEASE_NOTES.txt                               |  3 +++
 .../apache/http/benchmark/HttpBenchmark.java    |  2 +-
 .../org/apache/http/ssl/SSLContextBuilder.java  | 22 ++++++++++++++++++++
 .../apache/http/ssl/TestSSLContextBuilder.java  | 12 +++++++++++
 4 files changed, 38 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/6b592d5c/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index a3c75af..b29e546 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -15,6 +15,9 @@ Changelog
 * HTTPCORE-461: Add factory methods to DefaultHttpServerIODispatch to handle a null SSLContext.
   Contributed by Gary Gregory <ggregory at apache.org>
 
+* HTTPCORE-462: Deprecate SSLContextBuilder.useProtocol(String) in favor a new method setProtocol(String).
+  Contributed by Gary Gregory <ggregory at apache.org>
+
 
 Release 4.4.6
 -------------------

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/6b592d5c/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
----------------------------------------------------------------------
diff --git a/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java b/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
index a902819..3e15636 100644
--- a/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
+++ b/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
@@ -184,7 +184,7 @@ public class HttpBenchmark {
         SocketFactory socketFactory = null;
         if ("https".equals(host.getSchemeName())) {
             final SSLContextBuilder sslContextBuilder = new SSLContextBuilder();
-            sslContextBuilder.useProtocol("SSL");
+            sslContextBuilder.setProtocol("SSL");
             if (config.isDisableSSLVerification()) {
                 sslContextBuilder.loadTrustMaterial(null, new TrustStrategy() {
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/6b592d5c/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
index 70ed1f4..20d9eee 100644
--- a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
+++ b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
@@ -107,12 +107,34 @@ public class SSLContextBuilder {
      * @see <a href=
      *      "https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SSLContext">Java
      *      Cryptography Architecture Standard Algorithm Name Documentation</a>
+     * @deprecated Use {@link #setProtocol(String)}.
      */
+    @Deprecated
     public SSLContextBuilder useProtocol(final String protocol) {
         this.protocol = protocol;
         return this;
     }
 
+    /**
+     * Sets the SSLContext algorithm name.
+     *
+     * @param protocol
+     *            the SSLContext algorithm name of the requested protocol. See
+     *            the SSLContext section in the <a href=
+     *            "https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SSLContext">Java
+     *            Cryptography Architecture Standard Algorithm Name
+     *            Documentation</a> for more information.
+     * @return this builder
+     * @see <a href=
+     *      "https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SSLContext">Java
+     *      Cryptography Architecture Standard Algorithm Name Documentation</a>
+     * @since 4.4.7
+     */
+    public SSLContextBuilder setProtocol(final String protocol) {
+        this.protocol = protocol;
+        return this;
+    }
+
     public SSLContextBuilder setSecureRandom(final SecureRandom secureRandom) {
         this.secureRandom = secureRandom;
         return this;

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/6b592d5c/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java b/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
index b789fcf..c33ee11 100644
--- a/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
+++ b/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
@@ -90,6 +90,18 @@ public class TestSSLContextBuilder {
     @Test
     public void testBuildAllNull() throws Exception {
         final SSLContext sslContext = SSLContextBuilder.create()
+                .setProtocol(null)
+                .setSecureRandom(null)
+                .loadTrustMaterial((KeyStore) null, null)
+                .loadKeyMaterial((KeyStore) null, null, null)
+                .build();
+        Assert.assertNotNull(sslContext);
+        Assert.assertEquals("TLS", sslContext.getProtocol());
+    }
+
+    @Test
+    public void testBuildAllNull_deprecated() throws Exception {
+        final SSLContext sslContext = SSLContextBuilder.create()
                 .useProtocol(null)
                 .setSecureRandom(null)
                 .loadTrustMaterial((KeyStore) null, null)


[49/50] httpcomponents-core git commit: Use camel case for instance variable names (which are all private and final.)

Posted by ol...@apache.org.
Use camel case for instance variable names (which are all private and final.)

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1794493 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/8037d7d9
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/8037d7d9
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/8037d7d9

Branch: refs/heads/4.4.x
Commit: 8037d7d9192699b8f2912d2c6a70f7077b00e0fa
Parents: d95ad7c
Author: Gary D. Gregory <gg...@apache.org>
Authored: Tue May 9 02:52:37 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Tue May 9 02:52:37 2017 +0000

----------------------------------------------------------------------
 .../org/apache/http/ssl/SSLContextBuilder.java    | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/8037d7d9/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
index a2e68c4..ff4955f 100644
--- a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
+++ b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
@@ -79,8 +79,8 @@ public class SSLContextBuilder {
     static final String TLS   = "TLS";
 
     private String protocol;
-    private final Set<KeyManager> keymanagers;
-    private final Set<TrustManager> trustmanagers;
+    private final Set<KeyManager> keyManagers;
+    private final Set<TrustManager> trustManagers;
     private SecureRandom secureRandom;
     private Provider provider;
 
@@ -90,8 +90,8 @@ public class SSLContextBuilder {
 
     public SSLContextBuilder() {
         super();
-        this.keymanagers = new LinkedHashSet<KeyManager>();
-        this.trustmanagers = new LinkedHashSet<TrustManager>();
+        this.keyManagers = new LinkedHashSet<KeyManager>();
+        this.trustManagers = new LinkedHashSet<TrustManager>();
     }
 
     /**
@@ -168,7 +168,7 @@ public class SSLContextBuilder {
                 }
             }
             for (final TrustManager tm : tms) {
-                this.trustmanagers.add(tm);
+                this.trustManagers.add(tm);
             }
         }
         return this;
@@ -245,7 +245,7 @@ public class SSLContextBuilder {
                 }
             }
             for (final KeyManager km : kms) {
-                keymanagers.add(km);
+                keyManagers.add(km);
             }
         }
         return this;
@@ -322,7 +322,7 @@ public class SSLContextBuilder {
         } else {
             sslContext = SSLContext.getInstance(protocolStr);
         }
-        initSSLContext(sslContext, keymanagers, trustmanagers, secureRandom);
+        initSSLContext(sslContext, keyManagers, trustManagers, secureRandom);
         return sslContext;
     }
 
@@ -454,8 +454,8 @@ public class SSLContextBuilder {
      */
     @Override
     public String toString() {
-        return "[provider=" + provider + ", protocol=" + protocol + ", keymanagers=" + keymanagers
-                + ", trustmanagers=" + trustmanagers + ", secureRandom=" + secureRandom + "]";
+        return "[provider=" + provider + ", protocol=" + protocol + ", keymanagers=" + keyManagers
+                + ", trustmanagers=" + trustManagers + ", secureRandom=" + secureRandom + "]";
     }
 
 }


[34/50] httpcomponents-core git commit: Javadocs.

Posted by ol...@apache.org.
Javadocs.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1793820 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/2b8fb85c
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/2b8fb85c
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/2b8fb85c

Branch: refs/heads/4.4.x
Commit: 2b8fb85c620561717738d73f4888a9327915c01d
Parents: 89892b8
Author: Gary D. Gregory <gg...@apache.org>
Authored: Thu May 4 15:11:49 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Thu May 4 15:11:49 2017 +0000

----------------------------------------------------------------------
 .../java/org/apache/http/ssl/SSLContextBuilder.java   | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/2b8fb85c/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
index 2fe30b9..22ded79 100644
--- a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
+++ b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
@@ -93,6 +93,20 @@ public class SSLContextBuilder {
         this.trustmanagers = new LinkedHashSet<TrustManager>();
     }
 
+    /**
+     * Sets the SSLContext algorithm name.
+     * 
+     * @param protocol
+     *            the SSLContext algorithm name of the requested protocol. See
+     *            the SSLContext section in the <a href=
+     *            "https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SSLContext">Java
+     *            Cryptography Architecture Standard Algorithm Name
+     *            Documentation</a> for more information.
+     * @return this builder
+     * @see <a href=
+     *      "https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SSLContext">Java
+     *      Cryptography Architecture Standard Algorithm Name Documentation</a>
+     */
     public SSLContextBuilder useProtocol(final String protocol) {
         this.protocol = protocol;
         return this;


[14/50] httpcomponents-core git commit: Upgraded HttpCore version to 4.4.7-SNAPSHOT

Posted by ol...@apache.org.
Upgraded HttpCore version to 4.4.7-SNAPSHOT

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1778258 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/a15ca59c
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/a15ca59c
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/a15ca59c

Branch: refs/heads/4.4.x
Commit: a15ca59cf6808c7e4ab4a5a9184d6e4acd92ff15
Parents: 6933933
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Wed Jan 11 09:07:14 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Wed Jan 11 09:07:14 2017 +0000

----------------------------------------------------------------------
 httpcore-ab/pom.xml   | 2 +-
 httpcore-nio/pom.xml  | 2 +-
 httpcore-osgi/pom.xml | 2 +-
 httpcore/pom.xml      | 2 +-
 pom.xml               | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/a15ca59c/httpcore-ab/pom.xml
----------------------------------------------------------------------
diff --git a/httpcore-ab/pom.xml b/httpcore-ab/pom.xml
index f8e6010..6c03a70 100644
--- a/httpcore-ab/pom.xml
+++ b/httpcore-ab/pom.xml
@@ -28,7 +28,7 @@
   <parent>
     <groupId>org.apache.httpcomponents</groupId>
     <artifactId>httpcomponents-core</artifactId>
-    <version>4.4.6-SNAPSHOT</version>
+    <version>4.4.7-SNAPSHOT</version>
   </parent>
   <artifactId>httpcore-ab</artifactId>
   <name>Apache HttpCore Benchmarking Tool</name>

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/a15ca59c/httpcore-nio/pom.xml
----------------------------------------------------------------------
diff --git a/httpcore-nio/pom.xml b/httpcore-nio/pom.xml
index ec30ac6..90f7cbc 100644
--- a/httpcore-nio/pom.xml
+++ b/httpcore-nio/pom.xml
@@ -28,7 +28,7 @@
   <parent>
     <groupId>org.apache.httpcomponents</groupId>
     <artifactId>httpcomponents-core</artifactId>
-    <version>4.4.6-SNAPSHOT</version>
+    <version>4.4.7-SNAPSHOT</version>
   </parent>
   <artifactId>httpcore-nio</artifactId>
   <name>Apache HttpCore NIO</name>

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/a15ca59c/httpcore-osgi/pom.xml
----------------------------------------------------------------------
diff --git a/httpcore-osgi/pom.xml b/httpcore-osgi/pom.xml
index 46e451b..9fc0bcc 100644
--- a/httpcore-osgi/pom.xml
+++ b/httpcore-osgi/pom.xml
@@ -28,7 +28,7 @@
   <parent>
     <groupId>org.apache.httpcomponents</groupId>
     <artifactId>httpcomponents-core</artifactId>
-    <version>4.4.6-SNAPSHOT</version>
+    <version>4.4.7-SNAPSHOT</version>
   </parent>
   <artifactId>httpcore-osgi</artifactId>
   <name>Apache HttpCore OSGi bundle</name>

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/a15ca59c/httpcore/pom.xml
----------------------------------------------------------------------
diff --git a/httpcore/pom.xml b/httpcore/pom.xml
index 1e00bfd..108663a 100644
--- a/httpcore/pom.xml
+++ b/httpcore/pom.xml
@@ -28,7 +28,7 @@
   <parent>
     <groupId>org.apache.httpcomponents</groupId>
     <artifactId>httpcomponents-core</artifactId>
-    <version>4.4.6-SNAPSHOT</version>
+    <version>4.4.7-SNAPSHOT</version>
   </parent>
   <artifactId>httpcore</artifactId>
   <name>Apache HttpCore</name>

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/a15ca59c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 5cc93d1..45103bc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,7 +33,7 @@
   <modelVersion>4.0.0</modelVersion>
   <artifactId>httpcomponents-core</artifactId>
   <name>Apache HttpComponents Core</name>
-  <version>4.4.6-SNAPSHOT</version>
+  <version>4.4.7-SNAPSHOT</version>
   <description>Apache HttpComponents Core is a library of components for building HTTP enabled services</description>
   <url>http://hc.apache.org/httpcomponents-core</url>
   <inceptionYear>2005</inceptionYear>


[09/50] httpcomponents-core git commit: HTTPCORE-438: added protected #getContentType method to AbstractAsyncResponseConsumer for customization of Content-Type parsing / inference logic

Posted by ol...@apache.org.
HTTPCORE-438: added protected #getContentType method to AbstractAsyncResponseConsumer for customization of Content-Type parsing / inference logic

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1772539 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/d48412ec
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/d48412ec
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/d48412ec

Branch: refs/heads/4.4.x
Commit: d48412ec26e9b888d993bf12eedefba9c11301cb
Parents: d550a5e
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Sun Dec 4 14:31:10 2016 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Sun Dec 4 14:31:10 2016 +0000

----------------------------------------------------------------------
 .../http/nio/protocol/AbstractAsyncResponseConsumer.java  | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d48412ec/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncResponseConsumer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncResponseConsumer.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncResponseConsumer.java
index 860fa6b..0459fd2 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncResponseConsumer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncResponseConsumer.java
@@ -119,6 +119,13 @@ public abstract class AbstractAsyncResponseConsumer<T> implements HttpAsyncRespo
     }
 
     /**
+     * @since 4.4
+     */
+    protected ContentType getContentType(final HttpEntity entity) {
+        return entity != null ? ContentType.getOrDefault(entity) : null;
+    }
+
+    /**
      * Use {@link #onResponseReceived(HttpResponse)} instead.
      */
     @Override
@@ -127,8 +134,7 @@ public abstract class AbstractAsyncResponseConsumer<T> implements HttpAsyncRespo
         onResponseReceived(response);
         final HttpEntity entity = response.getEntity();
         if (entity != null) {
-            final ContentType contentType = ContentType.getOrDefault(entity);
-            onEntityEnclosed(entity, contentType);
+            onEntityEnclosed(entity, getContentType(entity));
         }
     }
 


[48/50] httpcomponents-core git commit: Add org.apache.http.ssl.SSLContextBuilder.toString() for debugging and logging.

Posted by ol...@apache.org.
Add org.apache.http.ssl.SSLContextBuilder.toString() for debugging and logging.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1794492 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/d95ad7cd
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/d95ad7cd
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/d95ad7cd

Branch: refs/heads/4.4.x
Commit: d95ad7cd097ee9de7cd08f9a95fe91e52a654652
Parents: 940f0ed
Author: Gary D. Gregory <gg...@apache.org>
Authored: Tue May 9 02:48:30 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Tue May 9 02:48:30 2017 +0000

----------------------------------------------------------------------
 .../main/java/org/apache/http/ssl/SSLContextBuilder.java    | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d95ad7cd/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
index 20d9eee..a2e68c4 100644
--- a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
+++ b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
@@ -449,4 +449,13 @@ public class SSLContextBuilder {
 
     }
 
+    /**
+     * @since 4.4.7
+     */
+    @Override
+    public String toString() {
+        return "[provider=" + provider + ", protocol=" + protocol + ", keymanagers=" + keymanagers
+                + ", trustmanagers=" + trustmanagers + ", secureRandom=" + secureRandom + "]";
+    }
+
 }


[16/50] httpcomponents-core git commit: Better local var name.

Posted by ol...@apache.org.
Better local var name.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1778358 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/f484626c
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/f484626c
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/f484626c

Branch: refs/heads/4.4.x
Commit: f484626c086537409e8091ba9bd521e503ae4119
Parents: 5f80041
Author: Gary D. Gregory <gg...@apache.org>
Authored: Wed Jan 11 23:45:05 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Wed Jan 11 23:45:05 2017 +0000

----------------------------------------------------------------------
 .../main/java/org/apache/http/util/EntityUtils.java | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/f484626c/httpcore/src/main/java/org/apache/http/util/EntityUtils.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/util/EntityUtils.java b/httpcore/src/main/java/org/apache/http/util/EntityUtils.java
index e401f4e..ac795b2 100644
--- a/httpcore/src/main/java/org/apache/http/util/EntityUtils.java
+++ b/httpcore/src/main/java/org/apache/http/util/EntityUtils.java
@@ -128,11 +128,11 @@ public final class EntityUtils {
         try {
             Args.check(entity.getContentLength() <= Integer.MAX_VALUE,
                     "HTTP entity too large to be buffered in memory");
-            int i = (int)entity.getContentLength();
-            if (i < 0) {
-                i = DEFAULT_BUFFER_SIZE;
+            int capacity = (int)entity.getContentLength();
+            if (capacity < 0) {
+                capacity = DEFAULT_BUFFER_SIZE;
             }
-            final ByteArrayBuffer buffer = new ByteArrayBuffer(i);
+            final ByteArrayBuffer buffer = new ByteArrayBuffer(capacity);
             final byte[] tmp = new byte[DEFAULT_BUFFER_SIZE];
             int l;
             while((l = instream.read(tmp)) != -1) {
@@ -205,9 +205,9 @@ public final class EntityUtils {
         try {
             Args.check(entity.getContentLength() <= Integer.MAX_VALUE,
                     "HTTP entity too large to be buffered in memory");
-            int i = (int)entity.getContentLength();
-            if (i < 0) {
-                i = DEFAULT_BUFFER_SIZE;
+            int capacity = (int)entity.getContentLength();
+            if (capacity < 0) {
+                capacity = DEFAULT_BUFFER_SIZE;
             }
             Charset charset = null;
             if (contentType != null) {
@@ -221,7 +221,7 @@ public final class EntityUtils {
                 charset = HTTP.DEF_CONTENT_CHARSET;
             }
             final Reader reader = new InputStreamReader(instream, charset);
-            final CharArrayBuffer buffer = new CharArrayBuffer(i);
+            final CharArrayBuffer buffer = new CharArrayBuffer(capacity);
             final char[] tmp = new char[1024];
             int l;
             while((l = reader.read(tmp)) != -1) {


[08/50] httpcomponents-core git commit: HTTPCORE-429: NIO connection pool incorrectly reports the number of pending connections per individual route

Posted by ol...@apache.org.
HTTPCORE-429: NIO connection pool incorrectly reports the number of pending connections per individual route

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1772395 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/d550a5ed
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/d550a5ed
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/d550a5ed

Branch: refs/heads/4.4.x
Commit: d550a5edcd7c8717cc7f0e2ddeb04a9c2742cfd3
Parents: 141eacd
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Fri Dec 2 18:53:51 2016 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri Dec 2 18:53:51 2016 +0000

----------------------------------------------------------------------
 .../java/org/apache/http/nio/pool/AbstractNIOConnPool.java  | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d550a5ed/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java b/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
index 02533ba..b4ee96d 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
@@ -59,6 +59,7 @@ import org.apache.http.pool.PoolEntryCallback;
 import org.apache.http.pool.PoolStats;
 import org.apache.http.util.Args;
 import org.apache.http.util.Asserts;
+import org.apache.http.util.LangUtils;
 
 /**
  * Abstract non-blocking connection pool.
@@ -682,9 +683,15 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
         this.lock.lock();
         try {
             final RouteSpecificPool<T, C, E> pool = getPool(route);
+            int pendingCount = 0;
+            for (LeaseRequest<T, C, E> request: leasingRequests) {
+                if (LangUtils.equals(route, request.getRoute())) {
+                    pendingCount++;
+                }
+            }
             return new PoolStats(
                     pool.getLeasedCount(),
-                    pool.getPendingCount(),
+                    pendingCount + pool.getPendingCount(),
                     pool.getAvailableCount(),
                     getMax(route));
         } finally {


[10/50] httpcomponents-core git commit: Update RAT plugin from 0.11 to 0.12 and centralize settings.

Posted by ol...@apache.org.
Update RAT plugin from 0.11 to 0.12 and centralize settings.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1772786 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/f2452dbf
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/f2452dbf
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/f2452dbf

Branch: refs/heads/4.4.x
Commit: f2452dbfaa9a0ff4a160b7f8b3eea13a96cc0f85
Parents: d48412e
Author: Gary D. Gregory <gg...@apache.org>
Authored: Mon Dec 5 20:22:27 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Mon Dec 5 20:22:27 2016 +0000

----------------------------------------------------------------------
 httpcore/pom.xml | 19 -------------------
 pom.xml          |  6 +++++-
 2 files changed, 5 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/f2452dbf/httpcore/pom.xml
----------------------------------------------------------------------
diff --git a/httpcore/pom.xml b/httpcore/pom.xml
index 21be1a5..1e00bfd 100644
--- a/httpcore/pom.xml
+++ b/httpcore/pom.xml
@@ -84,25 +84,6 @@
         </executions>
       </plugin>
       <plugin>
-        <groupId>org.apache.rat</groupId>
-        <artifactId>apache-rat-plugin</artifactId>
-        <executions>
-          <execution>
-            <phase>verify</phase>
-            <goals>
-              <goal>check</goal>
-            </goals>
-          </execution>
-        </executions>
-        <configuration>
-          <excludes>
-            <exclude>.externalToolBuilders/**</exclude>			
-            <exclude>.pmd</exclude>			
-            <exclude>maven-eclipse.xml</exclude>
-          </excludes>
-        </configuration>
-      </plugin>
-      <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-jar-plugin</artifactId>
           <version>2.6</version>

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/f2452dbf/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8639a5d..5cc93d1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -313,7 +313,7 @@
       <plugin>
         <groupId>org.apache.rat</groupId>
         <artifactId>apache-rat-plugin</artifactId>
-        <version>0.11</version>
+        <version>0.12</version>
         <executions>
           <execution>
             <phase>verify</phase>
@@ -324,6 +324,10 @@
         </executions>
         <configuration>
           <excludes>
+            <exclude>**/.externalToolBuilders/**</exclude>			
+            <exclude>**/.pmd</exclude>			
+            <exclude>**/maven-eclipse.xml</exclude>
+            <exclude>**/.checkstyle</exclude>
             <exclude>src/docbkx/resources/**</exclude>
             <exclude>src/test/resources/*.truststore</exclude>
           </excludes>


[47/50] httpcomponents-core git commit: Update tests from Mockito 1.8.5 to 1.10.19. Tests pass on Oracle Java 1.6.0_45 and Maven 3.0.5.

Posted by ol...@apache.org.
Update tests from Mockito 1.8.5 to 1.10.19. Tests pass on Oracle Java 1.6.0_45 and Maven 3.0.5.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1794462 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/940f0ed0
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/940f0ed0
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/940f0ed0

Branch: refs/heads/4.4.x
Commit: 940f0ed0fcd305c90d2650e520ca0988ed4f98b1
Parents: 6a5189b
Author: Gary D. Gregory <gg...@apache.org>
Authored: Mon May 8 20:59:01 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Mon May 8 20:59:01 2017 +0000

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/940f0ed0/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 45103bc..9e4196d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,7 +76,7 @@
     <maven.compiler.target>1.6</maven.compiler.target>
     <maven.compiler.showDeprecation>false</maven.compiler.showDeprecation>
     <junit.version>4.11</junit.version>
-    <mockito.version>1.8.5</mockito.version>
+    <mockito.version>1.10.19</mockito.version>
     <commons-logging.version>1.2</commons-logging.version>
     <api.comparison.version>4.4</api.comparison.version>
     <hc.stylecheck.version>1</hc.stylecheck.version>


[17/50] httpcomponents-core git commit: HTTPCORE-442: Non-blocking SSL sessions fail to decrypt buffered input data in some cases if closed by the opposite endpoint

Posted by ol...@apache.org.
HTTPCORE-442: Non-blocking SSL sessions fail to decrypt buffered input data in some cases if closed by the opposite endpoint

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1779966 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/10331fe5
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/10331fe5
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/10331fe5

Branch: refs/heads/4.4.x
Commit: 10331fe5e854cbf8067aa12b7cd441192751a188
Parents: f484626
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Mon Jan 23 19:59:46 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Mon Jan 23 19:59:46 2017 +0000

----------------------------------------------------------------------
 .../org/apache/http/nio/reactor/ssl/SSLIOSession.java    | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/10331fe5/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
index f619155..a84d1ff 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
@@ -470,19 +470,20 @@ public class SSLIOSession implements IOSession, SessionBufferStatus, SocketAcces
 
             try {
                 if (!inEncryptedBuf.hasRemaining() && result.getHandshakeStatus() == HandshakeStatus.NEED_UNWRAP) {
-                    throw new SSLException("Input buffer is full");
+                    throw new SSLException("Unable to complete SSL handshake");
                 }
-                if (result.getStatus() == Status.OK) {
+                final Status status = result.getStatus();
+                if (status == Status.OK) {
                     decrypted = true;
                 } else {
+                    if (status == Status.BUFFER_UNDERFLOW && this.endOfStream) {
+                        throw new SSLException("Unable to decrypt incoming data due to unexpected end of stream");
+                    }
                     break;
                 }
                 if (result.getHandshakeStatus() != HandshakeStatus.NOT_HANDSHAKING) {
                     break;
                 }
-                if (this.endOfStream) {
-                    break;
-                }
             } finally {
                 // Release inEncrypted if empty
                 if (this.inEncrypted.acquire().position() == 0) {


[23/50] httpcomponents-core git commit: Add missing '@Override' annotations.

Posted by ol...@apache.org.
Add missing '@Override' annotations.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1788707 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/0962ff44
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/0962ff44
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/0962ff44

Branch: refs/heads/4.4.x
Commit: 0962ff44074b80795ef32f8f56ce92c77116681d
Parents: b7cbb79
Author: Gary D. Gregory <gg...@apache.org>
Authored: Sun Mar 26 02:28:02 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Sun Mar 26 02:28:02 2017 +0000

----------------------------------------------------------------------
 .../http/impl/AbstractHttpClientConnection.java      |  8 ++++++++
 .../http/impl/AbstractHttpServerConnection.java      |  7 +++++++
 .../apache/http/impl/SocketHttpClientConnection.java |  9 +++++++++
 .../apache/http/impl/SocketHttpServerConnection.java |  9 +++++++++
 .../http/impl/io/AbstractSessionInputBuffer.java     |  9 +++++++++
 .../http/impl/io/AbstractSessionOutputBuffer.java    | 10 ++++++++++
 .../org/apache/http/impl/io/SocketInputBuffer.java   |  2 ++
 .../org/apache/http/params/DefaultedHttpParams.java  |  4 ++++
 .../org/apache/http/protocol/BasicHttpProcessor.java | 15 +++++++++++++++
 .../apache/http/protocol/DefaultedHttpContext.java   |  3 +++
 .../http/protocol/HttpRequestHandlerRegistry.java    |  1 +
 .../java/org/apache/http/util/CharArrayBuffer.java   |  2 ++
 12 files changed, 79 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/0962ff44/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpClientConnection.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpClientConnection.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpClientConnection.java
index 672e482..fecec64 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpClientConnection.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpClientConnection.java
@@ -236,6 +236,7 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
                 outbuffer.getMetrics());
     }
 
+    @Override
     public boolean isResponseAvailable(final int timeout) throws IOException {
         assertOpen();
         try {
@@ -245,6 +246,7 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
         }
     }
 
+    @Override
     public void sendRequestHeader(final HttpRequest request)
             throws HttpException, IOException {
         Args.notNull(request, "HTTP request");
@@ -253,6 +255,7 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
         this.metrics.incrementRequestCount();
     }
 
+    @Override
     public void sendRequestEntity(final HttpEntityEnclosingRequest request)
             throws HttpException, IOException {
         Args.notNull(request, "HTTP request");
@@ -270,11 +273,13 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
         this.outbuffer.flush();
     }
 
+    @Override
     public void flush() throws IOException {
         assertOpen();
         doFlush();
     }
 
+    @Override
     public HttpResponse receiveResponseHeader()
             throws HttpException, IOException {
         assertOpen();
@@ -285,6 +290,7 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
         return response;
     }
 
+    @Override
     public void receiveResponseEntity(final HttpResponse response)
             throws HttpException, IOException {
         Args.notNull(response, "HTTP response");
@@ -297,6 +303,7 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
         return this.eofSensor != null && this.eofSensor.isEof();
     }
 
+    @Override
     public boolean isStale() {
         if (!isOpen()) {
             return true;
@@ -314,6 +321,7 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
         }
     }
 
+    @Override
     public HttpConnectionMetrics getMetrics() {
         return this.metrics;
     }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/0962ff44/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpServerConnection.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpServerConnection.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpServerConnection.java
index 8abc573..28465a4 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpServerConnection.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpServerConnection.java
@@ -236,6 +236,7 @@ public abstract class AbstractHttpServerConnection implements HttpServerConnecti
                 outbuffer.getMetrics());
     }
 
+    @Override
     public HttpRequest receiveRequestHeader()
             throws HttpException, IOException {
         assertOpen();
@@ -244,6 +245,7 @@ public abstract class AbstractHttpServerConnection implements HttpServerConnecti
         return request;
     }
 
+    @Override
     public void receiveRequestEntity(final HttpEntityEnclosingRequest request)
             throws HttpException, IOException {
         Args.notNull(request, "HTTP request");
@@ -256,11 +258,13 @@ public abstract class AbstractHttpServerConnection implements HttpServerConnecti
         this.outbuffer.flush();
     }
 
+    @Override
     public void flush() throws IOException {
         assertOpen();
         doFlush();
     }
 
+    @Override
     public void sendResponseHeader(final HttpResponse response)
             throws HttpException, IOException {
         Args.notNull(response, "HTTP response");
@@ -271,6 +275,7 @@ public abstract class AbstractHttpServerConnection implements HttpServerConnecti
         }
     }
 
+    @Override
     public void sendResponseEntity(final HttpResponse response)
             throws HttpException, IOException {
         if (response.getEntity() == null) {
@@ -286,6 +291,7 @@ public abstract class AbstractHttpServerConnection implements HttpServerConnecti
         return this.eofSensor != null && this.eofSensor.isEof();
     }
 
+    @Override
     public boolean isStale() {
         if (!isOpen()) {
             return true;
@@ -301,6 +307,7 @@ public abstract class AbstractHttpServerConnection implements HttpServerConnecti
         }
     }
 
+    @Override
     public HttpConnectionMetrics getMetrics() {
         return this.metrics;
     }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/0962ff44/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpClientConnection.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpClientConnection.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpClientConnection.java
index 0980ab5..0d98a88 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpClientConnection.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpClientConnection.java
@@ -151,6 +151,7 @@ public class SocketHttpClientConnection
         this.open = true;
     }
 
+    @Override
     public boolean isOpen() {
         return this.open;
     }
@@ -159,6 +160,7 @@ public class SocketHttpClientConnection
         return this.socket;
     }
 
+    @Override
     public InetAddress getLocalAddress() {
         if (this.socket != null) {
             return this.socket.getLocalAddress();
@@ -167,6 +169,7 @@ public class SocketHttpClientConnection
         }
     }
 
+    @Override
     public int getLocalPort() {
         if (this.socket != null) {
             return this.socket.getLocalPort();
@@ -175,6 +178,7 @@ public class SocketHttpClientConnection
         }
     }
 
+    @Override
     public InetAddress getRemoteAddress() {
         if (this.socket != null) {
             return this.socket.getInetAddress();
@@ -183,6 +187,7 @@ public class SocketHttpClientConnection
         }
     }
 
+    @Override
     public int getRemotePort() {
         if (this.socket != null) {
             return this.socket.getPort();
@@ -191,6 +196,7 @@ public class SocketHttpClientConnection
         }
     }
 
+    @Override
     public void setSocketTimeout(final int timeout) {
         assertOpen();
         if (this.socket != null) {
@@ -204,6 +210,7 @@ public class SocketHttpClientConnection
         }
     }
 
+    @Override
     public int getSocketTimeout() {
         if (this.socket != null) {
             try {
@@ -216,6 +223,7 @@ public class SocketHttpClientConnection
         }
     }
 
+    @Override
     public void shutdown() throws IOException {
         this.open = false;
         final Socket tmpsocket = this.socket;
@@ -224,6 +232,7 @@ public class SocketHttpClientConnection
         }
     }
 
+    @Override
     public void close() throws IOException {
         if (!this.open) {
             return;

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/0962ff44/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpServerConnection.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpServerConnection.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpServerConnection.java
index dfffe8b..c343058 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpServerConnection.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpServerConnection.java
@@ -144,10 +144,12 @@ public class SocketHttpServerConnection extends
         return this.socket;
     }
 
+    @Override
     public boolean isOpen() {
         return this.open;
     }
 
+    @Override
     public InetAddress getLocalAddress() {
         if (this.socket != null) {
             return this.socket.getLocalAddress();
@@ -156,6 +158,7 @@ public class SocketHttpServerConnection extends
         }
     }
 
+    @Override
     public int getLocalPort() {
         if (this.socket != null) {
             return this.socket.getLocalPort();
@@ -164,6 +167,7 @@ public class SocketHttpServerConnection extends
         }
     }
 
+    @Override
     public InetAddress getRemoteAddress() {
         if (this.socket != null) {
             return this.socket.getInetAddress();
@@ -172,6 +176,7 @@ public class SocketHttpServerConnection extends
         }
     }
 
+    @Override
     public int getRemotePort() {
         if (this.socket != null) {
             return this.socket.getPort();
@@ -180,6 +185,7 @@ public class SocketHttpServerConnection extends
         }
     }
 
+    @Override
     public void setSocketTimeout(final int timeout) {
         assertOpen();
         if (this.socket != null) {
@@ -193,6 +199,7 @@ public class SocketHttpServerConnection extends
         }
     }
 
+    @Override
     public int getSocketTimeout() {
         if (this.socket != null) {
             try {
@@ -205,6 +212,7 @@ public class SocketHttpServerConnection extends
         }
     }
 
+    @Override
     public void shutdown() throws IOException {
         this.open = false;
         final Socket tmpsocket = this.socket;
@@ -213,6 +221,7 @@ public class SocketHttpServerConnection extends
         }
     }
 
+    @Override
     public void close() throws IOException {
         if (!this.open) {
             return;

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/0962ff44/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java
index d36d8e4..7a33671 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java
@@ -124,6 +124,7 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
     /**
      * @since 4.1
      */
+    @Override
     public int capacity() {
         return this.buffer.length;
     }
@@ -131,6 +132,7 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
     /**
      * @since 4.1
      */
+    @Override
     public int length() {
         return this.bufferlen - this.bufferpos;
     }
@@ -138,6 +140,7 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
     /**
      * @since 4.1
      */
+    @Override
     public int available() {
         return capacity() - length();
     }
@@ -169,6 +172,7 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
         return this.bufferpos < this.bufferlen;
     }
 
+    @Override
     public int read() throws IOException {
         int noRead;
         while (!hasBufferedData()) {
@@ -180,6 +184,7 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
         return this.buffer[this.bufferpos++] & 0xff;
     }
 
+    @Override
     public int read(final byte[] b, final int off, final int len) throws IOException {
         if (b == null) {
             return 0;
@@ -213,6 +218,7 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
         }
     }
 
+    @Override
     public int read(final byte[] b) throws IOException {
         if (b == null) {
             return 0;
@@ -244,6 +250,7 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
      * @return     one line of characters
      * @exception  IOException  if an I/O error occurs.
      */
+    @Override
     public int readLine(final CharArrayBuffer charbuffer) throws IOException {
         Args.notNull(charbuffer, "Char array buffer");
         int noRead = 0;
@@ -382,6 +389,7 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
         return len;
     }
 
+    @Override
     public String readLine() throws IOException {
         final CharArrayBuffer charbuffer = new CharArrayBuffer(64);
         final int l = readLine(charbuffer);
@@ -392,6 +400,7 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
         }
     }
 
+    @Override
     public HttpTransportMetrics getMetrics() {
         return this.metrics;
     }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/0962ff44/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
index 0266232..aba72ea 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
@@ -133,6 +133,7 @@ public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer
     /**
      * @since 4.1
      */
+    @Override
     public int capacity() {
         return this.buffer.capacity();
     }
@@ -140,6 +141,7 @@ public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer
     /**
      * @since 4.1
      */
+    @Override
     public int length() {
         return this.buffer.length();
     }
@@ -147,6 +149,7 @@ public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer
     /**
      * @since 4.1
      */
+    @Override
     public int available() {
         return capacity() - length();
     }
@@ -160,11 +163,13 @@ public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer
         }
     }
 
+    @Override
     public void flush() throws IOException {
         flushBuffer();
         this.outstream.flush();
     }
 
+    @Override
     public void write(final byte[] b, final int off, final int len) throws IOException {
         if (b == null) {
             return;
@@ -190,6 +195,7 @@ public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer
         }
     }
 
+    @Override
     public void write(final byte[] b) throws IOException {
         if (b == null) {
             return;
@@ -197,6 +203,7 @@ public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer
         write(b, 0, b.length);
     }
 
+    @Override
     public void write(final int b) throws IOException {
         if (this.buffer.isFull()) {
             flushBuffer();
@@ -213,6 +220,7 @@ public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer
      * @param      s   the line.
      * @exception  IOException  if an I/O error occurs.
      */
+    @Override
     public void writeLine(final String s) throws IOException {
         if (s == null) {
             return;
@@ -239,6 +247,7 @@ public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer
      * @param      charbuffer the buffer containing chars of the line.
      * @exception  IOException  if an I/O error occurs.
      */
+    @Override
     public void writeLine(final CharArrayBuffer charbuffer) throws IOException {
         if (charbuffer == null) {
             return;
@@ -298,6 +307,7 @@ public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer
         this.bbuf.compact();
     }
 
+    @Override
     public HttpTransportMetrics getMetrics() {
         return this.metrics;
     }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/0962ff44/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketInputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketInputBuffer.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketInputBuffer.java
index 86f39dc..246ca0a 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketInputBuffer.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketInputBuffer.java
@@ -84,6 +84,7 @@ public class SocketInputBuffer extends AbstractSessionInputBuffer implements Eof
         return i;
     }
 
+    @Override
     public boolean isDataAvailable(final int timeout) throws IOException {
         boolean result = hasBufferedData();
         if (!result) {
@@ -99,6 +100,7 @@ public class SocketInputBuffer extends AbstractSessionInputBuffer implements Eof
         return result;
     }
 
+    @Override
     public boolean isEof() {
         return this.eof;
     }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/0962ff44/httpcore/src/main/java-deprecated/org/apache/http/params/DefaultedHttpParams.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/params/DefaultedHttpParams.java b/httpcore/src/main/java-deprecated/org/apache/http/params/DefaultedHttpParams.java
index 5731c41..547e5cb 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/params/DefaultedHttpParams.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/params/DefaultedHttpParams.java
@@ -64,6 +64,7 @@ public final class DefaultedHttpParams extends AbstractHttpParams {
     /**
      * Creates a copy of the local collection with the same default
      */
+    @Override
     public HttpParams copy() {
         final HttpParams clone = this.local.copy();
         return new DefaultedHttpParams(clone, this.defaults);
@@ -74,6 +75,7 @@ public final class DefaultedHttpParams extends AbstractHttpParams {
      * parameter is not set locally, delegates its resolution to the default
      * collection.
      */
+    @Override
     public Object getParameter(final String name) {
         Object obj = this.local.getParameter(name);
         if (obj == null && this.defaults != null) {
@@ -86,6 +88,7 @@ public final class DefaultedHttpParams extends AbstractHttpParams {
      * Attempts to remove the parameter from the local collection. This method
      * <i>does not</i> modify the default collection.
      */
+    @Override
     public boolean removeParameter(final String name) {
         return this.local.removeParameter(name);
     }
@@ -94,6 +97,7 @@ public final class DefaultedHttpParams extends AbstractHttpParams {
      * Sets the parameter in the local collection. This method <i>does not</i>
      * modify the default collection.
      */
+    @Override
     public HttpParams setParameter(final String name, final Object value) {
         return this.local.setParameter(name, value);
     }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/0962ff44/httpcore/src/main/java-deprecated/org/apache/http/protocol/BasicHttpProcessor.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/protocol/BasicHttpProcessor.java b/httpcore/src/main/java-deprecated/org/apache/http/protocol/BasicHttpProcessor.java
index 33f4f5d..681140c 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/protocol/BasicHttpProcessor.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/protocol/BasicHttpProcessor.java
@@ -57,6 +57,7 @@ public final class BasicHttpProcessor implements
     protected final List<HttpRequestInterceptor> requestInterceptors = new ArrayList<HttpRequestInterceptor>();
     protected final List<HttpResponseInterceptor> responseInterceptors = new ArrayList<HttpResponseInterceptor>();
 
+    @Override
     public void addRequestInterceptor(final HttpRequestInterceptor itcp) {
         if (itcp == null) {
             return;
@@ -64,6 +65,7 @@ public final class BasicHttpProcessor implements
         this.requestInterceptors.add(itcp);
     }
 
+    @Override
     public void addRequestInterceptor(
             final HttpRequestInterceptor itcp, final int index) {
         if (itcp == null) {
@@ -72,6 +74,7 @@ public final class BasicHttpProcessor implements
         this.requestInterceptors.add(index, itcp);
     }
 
+    @Override
     public void addResponseInterceptor(
             final HttpResponseInterceptor itcp, final int index) {
         if (itcp == null) {
@@ -80,6 +83,7 @@ public final class BasicHttpProcessor implements
         this.responseInterceptors.add(index, itcp);
     }
 
+    @Override
     public void removeRequestInterceptorByClass(final Class<? extends HttpRequestInterceptor> clazz) {
         for (final Iterator<HttpRequestInterceptor> it = this.requestInterceptors.iterator();
              it.hasNext(); ) {
@@ -90,6 +94,7 @@ public final class BasicHttpProcessor implements
         }
     }
 
+    @Override
     public void removeResponseInterceptorByClass(final Class<? extends HttpResponseInterceptor> clazz) {
         for (final Iterator<HttpResponseInterceptor> it = this.responseInterceptors.iterator();
              it.hasNext(); ) {
@@ -108,10 +113,12 @@ public final class BasicHttpProcessor implements
         addRequestInterceptor(interceptor, index);
     }
 
+    @Override
     public int getRequestInterceptorCount() {
         return this.requestInterceptors.size();
     }
 
+    @Override
     public HttpRequestInterceptor getRequestInterceptor(final int index) {
         if ((index < 0) || (index >= this.requestInterceptors.size())) {
             return null;
@@ -119,10 +126,12 @@ public final class BasicHttpProcessor implements
         return this.requestInterceptors.get(index);
     }
 
+    @Override
     public void clearRequestInterceptors() {
         this.requestInterceptors.clear();
     }
 
+    @Override
     public void addResponseInterceptor(final HttpResponseInterceptor itcp) {
         if (itcp == null) {
             return;
@@ -138,10 +147,12 @@ public final class BasicHttpProcessor implements
         addResponseInterceptor(interceptor, index);
     }
 
+    @Override
     public int getResponseInterceptorCount() {
         return this.responseInterceptors.size();
     }
 
+    @Override
     public HttpResponseInterceptor getResponseInterceptor(final int index) {
         if ((index < 0) || (index >= this.responseInterceptors.size())) {
             return null;
@@ -149,6 +160,7 @@ public final class BasicHttpProcessor implements
         return this.responseInterceptors.get(index);
     }
 
+    @Override
     public void clearResponseInterceptors() {
         this.responseInterceptors.clear();
     }
@@ -170,6 +182,7 @@ public final class BasicHttpProcessor implements
      * @param list      the list of request and response interceptors
      *                  from which to initialize
      */
+    @Override
     public void setInterceptors(final List<?> list) {
         Args.notNull(list, "Inteceptor list");
         this.requestInterceptors.clear();
@@ -192,6 +205,7 @@ public final class BasicHttpProcessor implements
         clearResponseInterceptors();
     }
 
+    @Override
     public void process(
             final HttpRequest request,
             final HttpContext context)
@@ -201,6 +215,7 @@ public final class BasicHttpProcessor implements
         }
     }
 
+    @Override
     public void process(
             final HttpResponse response,
             final HttpContext context)

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/0962ff44/httpcore/src/main/java-deprecated/org/apache/http/protocol/DefaultedHttpContext.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/protocol/DefaultedHttpContext.java b/httpcore/src/main/java-deprecated/org/apache/http/protocol/DefaultedHttpContext.java
index abcf7f0..1217271 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/protocol/DefaultedHttpContext.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/protocol/DefaultedHttpContext.java
@@ -51,6 +51,7 @@ public final class DefaultedHttpContext implements HttpContext {
         this.defaults = defaults;
     }
 
+    @Override
     public Object getAttribute(final String id) {
         final Object obj = this.local.getAttribute(id);
         if (obj == null) {
@@ -60,10 +61,12 @@ public final class DefaultedHttpContext implements HttpContext {
         }
     }
 
+    @Override
     public Object removeAttribute(final String id) {
         return this.local.removeAttribute(id);
     }
 
+    @Override
     public void setAttribute(final String id, final Object obj) {
         this.local.setAttribute(id, obj);
     }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/0962ff44/httpcore/src/main/java-deprecated/org/apache/http/protocol/HttpRequestHandlerRegistry.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/protocol/HttpRequestHandlerRegistry.java b/httpcore/src/main/java-deprecated/org/apache/http/protocol/HttpRequestHandlerRegistry.java
index 33b9932..a86633a 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/protocol/HttpRequestHandlerRegistry.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/protocol/HttpRequestHandlerRegistry.java
@@ -101,6 +101,7 @@ public class HttpRequestHandlerRegistry implements HttpRequestHandlerResolver {
         return matcher.getObjects();
     }
 
+    @Override
     public HttpRequestHandler lookup(final String requestURI) {
         return matcher.lookup(requestURI);
     }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/0962ff44/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java b/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java
index 4af2e25..36c4d75 100644
--- a/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java
+++ b/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java
@@ -257,6 +257,7 @@ public final class CharArrayBuffer implements CharSequence, Serializable {
      * @throws     IndexOutOfBoundsException  if {@code index} is
      *             negative or greater than or equal to {@link #length()}.
      */
+    @Override
     public char charAt(final int i) {
         return this.buffer[i];
     }
@@ -286,6 +287,7 @@ public final class CharArrayBuffer implements CharSequence, Serializable {
      *
      * @return  the length of the buffer
      */
+    @Override
     public int length() {
         return this.len;
     }


[45/50] httpcomponents-core git commit: Add @since tag to toString() method. Local build OK.

Posted by ol...@apache.org.
Add @since tag to toString() method. Local build OK.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1794175 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/04721b92
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/04721b92
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/04721b92

Branch: refs/heads/4.4.x
Commit: 04721b924b4470e40fa74e64e843083a1321f8c8
Parents: a7f903c
Author: Gary D. Gregory <gg...@apache.org>
Authored: Sat May 6 19:22:52 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Sat May 6 19:22:52 2017 +0000

----------------------------------------------------------------------
 .../main/java/org/apache/http/impl/nio/SessionHttpContext.java    | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/04721b92/httpcore-nio/src/main/java/org/apache/http/impl/nio/SessionHttpContext.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SessionHttpContext.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SessionHttpContext.java
index c6aa3e6..21b6ed6 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SessionHttpContext.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SessionHttpContext.java
@@ -54,6 +54,9 @@ class SessionHttpContext implements HttpContext {
         this.iosession.setAttribute(id, obj);
     }
 
+    /**
+     * @since 4.4.7
+     */
     @Override
     public String toString() {
         final StringBuilder sb = new StringBuilder();


[32/50] httpcomponents-core git commit: Replace @exception with the more modern @throws.

Posted by ol...@apache.org.
Replace @exception with the more modern @throws.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1792678 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/751f349f
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/751f349f
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/751f349f

Branch: refs/heads/4.4.x
Commit: 751f349f78c0d1ea51636091da6b74443c84145d
Parents: 1eea026
Author: Gary D. Gregory <gg...@apache.org>
Authored: Tue Apr 25 22:57:48 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Tue Apr 25 22:57:48 2017 +0000

----------------------------------------------------------------------
 .../org/apache/http/nio/util/ContentInputBuffer.java    |  2 +-
 .../org/apache/http/nio/util/ContentOutputBuffer.java   |  6 +++---
 .../apache/http/impl/io/AbstractSessionInputBuffer.java |  4 ++--
 .../http/impl/io/AbstractSessionOutputBuffer.java       |  4 ++--
 .../org/apache/http/impl/io/SessionInputBufferImpl.java |  4 ++--
 .../apache/http/impl/io/SessionOutputBufferImpl.java    |  4 ++--
 .../java/org/apache/http/io/SessionInputBuffer.java     | 12 ++++++------
 .../java/org/apache/http/io/SessionOutputBuffer.java    | 12 ++++++------
 .../main/java/org/apache/http/util/CharArrayBuffer.java |  4 ++--
 9 files changed, 26 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/751f349f/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java b/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java
index dc4608f..3ec778f 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java
@@ -75,7 +75,7 @@ public interface ContentInputBuffer {
      * @return     the total number of bytes read into the buffer, or
      *             {@code -1} if there is no more data because the end of
      *             the stream has been reached.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     int read(byte[] b, int off, int len) throws IOException;
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/751f349f/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentOutputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentOutputBuffer.java b/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentOutputBuffer.java
index 8a7dae4..9fd151c 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentOutputBuffer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentOutputBuffer.java
@@ -73,7 +73,7 @@ public interface ContentOutputBuffer {
      * @param      b     the data.
      * @param      off   the start offset in the data.
      * @param      len   the number of bytes to write.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     void write(byte[] b, int off, int len) throws IOException;
 
@@ -81,13 +81,13 @@ public interface ContentOutputBuffer {
      * Writes the specified byte to this buffer.
      *
      * @param      b   the {@code byte}.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     void write(int b) throws IOException;
 
     /**
      * Indicates the content has been fully written.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     void writeCompleted() throws IOException;
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/751f349f/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java
index 7a33671..6ce8018 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java
@@ -248,7 +248,7 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
      *
      * @param      charbuffer   the line buffer.
      * @return     one line of characters
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     @Override
     public int readLine(final CharArrayBuffer charbuffer) throws IOException {
@@ -302,7 +302,7 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
      * to CR-LF required by the HTTP specification.
      *
      * @return HTTP line as a string
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     private int lineFromLineBuffer(final CharArrayBuffer charbuffer)
             throws IOException {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/751f349f/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
index aba72ea..38c14de 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
@@ -218,7 +218,7 @@ public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer
      * This method uses CR-LF as a line delimiter.
      *
      * @param      s   the line.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     @Override
     public void writeLine(final String s) throws IOException {
@@ -245,7 +245,7 @@ public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer
      * This method uses CR-LF as a line delimiter.
      *
      * @param      charbuffer the buffer containing chars of the line.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     @Override
     public void writeLine(final CharArrayBuffer charbuffer) throws IOException {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/751f349f/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java b/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java
index 44d1da5..33d20f1 100644
--- a/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java
+++ b/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java
@@ -236,7 +236,7 @@ public class SessionInputBufferImpl implements SessionInputBuffer, BufferInfo {
      *
      * @param      charbuffer   the line buffer.
      * @return     one line of characters
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     @Override
     public int readLine(final CharArrayBuffer charbuffer) throws IOException {
@@ -303,7 +303,7 @@ public class SessionInputBufferImpl implements SessionInputBuffer, BufferInfo {
      * to CR-LF required by the HTTP specification.
      *
      * @return HTTP line as a string
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     private int lineFromLineBuffer(final CharArrayBuffer charbuffer)
             throws IOException {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/751f349f/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java b/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java
index efa5a2f..3ed5206 100644
--- a/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java
+++ b/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java
@@ -199,7 +199,7 @@ public class SessionOutputBufferImpl implements SessionOutputBuffer, BufferInfo
      * This method uses CR-LF as a line delimiter.
      *
      * @param      s   the line.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     @Override
     public void writeLine(final String s) throws IOException {
@@ -226,7 +226,7 @@ public class SessionOutputBufferImpl implements SessionOutputBuffer, BufferInfo
      * This method uses CR-LF as a line delimiter.
      *
      * @param      charbuffer the buffer containing chars of the line.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     @Override
     public void writeLine(final CharArrayBuffer charbuffer) throws IOException {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/751f349f/httpcore/src/main/java/org/apache/http/io/SessionInputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/io/SessionInputBuffer.java b/httpcore/src/main/java/org/apache/http/io/SessionInputBuffer.java
index c3b3a22..ba0f4a9 100644
--- a/httpcore/src/main/java/org/apache/http/io/SessionInputBuffer.java
+++ b/httpcore/src/main/java/org/apache/http/io/SessionInputBuffer.java
@@ -63,7 +63,7 @@ public interface SessionInputBuffer {
      * @return     the total number of bytes read into the buffer, or
      *             {@code -1} if there is no more data because the end of
      *             the stream has been reached.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     int read(byte[] b, int off, int len) throws IOException;
 
@@ -77,7 +77,7 @@ public interface SessionInputBuffer {
      * @return     the total number of bytes read into the buffer, or
      *             {@code -1} is there is no more data because the end of
      *             the stream has been reached.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     int read(byte[] b) throws IOException;
 
@@ -91,7 +91,7 @@ public interface SessionInputBuffer {
      *
      * @return     the next byte of data, or {@code -1} if the end of the
      *             stream is reached.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     int read() throws IOException;
 
@@ -108,7 +108,7 @@ public interface SessionInputBuffer {
      *
      * @param      buffer   the line buffer.
      * @return     one line of characters
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     int readLine(CharArrayBuffer buffer) throws IOException;
 
@@ -123,7 +123,7 @@ public interface SessionInputBuffer {
      * specific implementations of this interface.
      *
      * @return HTTP line as a string
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     String readLine() throws IOException;
 
@@ -134,7 +134,7 @@ public interface SessionInputBuffer {
      * @param timeout in milliseconds.
      * @return {@code true} if some data is available in the session
      *   buffer or {@code false} otherwise.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      *
      * @deprecated (4.3) do not use. This function should be provided at the
      *   connection level

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/751f349f/httpcore/src/main/java/org/apache/http/io/SessionOutputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/io/SessionOutputBuffer.java b/httpcore/src/main/java/org/apache/http/io/SessionOutputBuffer.java
index 40ae69e..666762a 100644
--- a/httpcore/src/main/java/org/apache/http/io/SessionOutputBuffer.java
+++ b/httpcore/src/main/java/org/apache/http/io/SessionOutputBuffer.java
@@ -53,7 +53,7 @@ public interface SessionOutputBuffer {
      * @param      b     the data.
      * @param      off   the start offset in the data.
      * @param      len   the number of bytes to write.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     void write(byte[] b, int off, int len) throws IOException;
 
@@ -62,7 +62,7 @@ public interface SessionOutputBuffer {
      * to this session buffer.
      *
      * @param      b   the data.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     void write(byte[] b) throws IOException;
 
@@ -70,7 +70,7 @@ public interface SessionOutputBuffer {
      * Writes the specified byte to this session buffer.
      *
      * @param      b   the {@code byte}.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     void write(int b) throws IOException;
 
@@ -82,7 +82,7 @@ public interface SessionOutputBuffer {
      * specific implementations of this interface.
      *
      * @param      s   the line.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     void writeLine(String s) throws IOException;
 
@@ -94,7 +94,7 @@ public interface SessionOutputBuffer {
      * specific implementations of this interface.
      *
      * @param      buffer   the buffer containing chars of the line.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     void writeLine(CharArrayBuffer buffer) throws IOException;
 
@@ -106,7 +106,7 @@ public interface SessionOutputBuffer {
      * stream, such bytes should immediately be written to their
      * intended destination.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     void flush() throws IOException;
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/751f349f/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java b/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java
index 36c4d75..a97a373 100644
--- a/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java
+++ b/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java
@@ -410,7 +410,7 @@ public final class CharArrayBuffer implements CharSequence, Serializable {
      * @param      beginIndex   the beginning index, inclusive.
      * @param      endIndex     the ending index, exclusive.
      * @return     the specified substring.
-     * @exception  StringIndexOutOfBoundsException  if the
+     * @throws  StringIndexOutOfBoundsException  if the
      *             {@code beginIndex} is negative, or
      *             {@code endIndex} is larger than the length of this
      *             buffer, or {@code beginIndex} is larger than
@@ -439,7 +439,7 @@ public final class CharArrayBuffer implements CharSequence, Serializable {
      * @param      beginIndex   the beginning index, inclusive.
      * @param      endIndex     the ending index, exclusive.
      * @return     the specified substring.
-     * @exception  IndexOutOfBoundsException  if the
+     * @throws  IndexOutOfBoundsException  if the
      *             {@code beginIndex} is negative, or
      *             {@code endIndex} is larger than the length of this
      *             buffer, or {@code beginIndex} is larger than


[05/50] httpcomponents-core git commit: HTTPCORE-433: redesign of connection request future used by blocking AbstractConnPool

Posted by ol...@apache.org.
HTTPCORE-433: redesign of connection request future used by blocking AbstractConnPool

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1770878 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/f6b4a9da
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/f6b4a9da
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/f6b4a9da

Branch: refs/heads/4.4.x
Commit: f6b4a9da9887ef56de62b8a36131a16ad58eca97
Parents: 58c75ad
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Tue Nov 22 19:46:29 2016 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Tue Nov 22 19:46:29 2016 +0000

----------------------------------------------------------------------
 .../org/apache/http/pool/AbstractConnPool.java  | 107 ++++++++++--
 .../org/apache/http/pool/PoolEntryFuture.java   | 161 -------------------
 .../org/apache/http/pool/RouteSpecificPool.java |  13 +-
 .../apache/http/pool/TestRouteSpecificPool.java |   7 +-
 4 files changed, 102 insertions(+), 186 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/f6b4a9da/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java b/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
index 98831e0..51b0453 100644
--- a/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
+++ b/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
@@ -34,14 +34,16 @@ import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
+import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 
-import org.apache.http.annotation.ThreadingBehavior;
 import org.apache.http.annotation.Contract;
+import org.apache.http.annotation.ThreadingBehavior;
 import org.apache.http.concurrent.FutureCallback;
 import org.apache.http.util.Args;
 import org.apache.http.util.Asserts;
@@ -66,11 +68,12 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
                                                implements ConnPool<T, E>, ConnPoolControl<T> {
 
     private final Lock lock;
+    private final Condition condition;
     private final ConnFactory<T, C> connFactory;
     private final Map<T, RouteSpecificPool<T, C, E>> routeToPool;
     private final Set<E> leased;
     private final LinkedList<E> available;
-    private final LinkedList<PoolEntryFuture<E>> pending;
+    private final LinkedList<Future<E>> pending;
     private final Map<T, Integer> maxPerRoute;
 
     private volatile boolean isShutDown;
@@ -87,10 +90,11 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
         this.defaultMaxPerRoute = Args.positive(defaultMaxPerRoute, "Max per route value");
         this.maxTotal = Args.positive(maxTotal, "Max total value");
         this.lock = new ReentrantLock();
+        this.condition = this.lock.newCondition();
         this.routeToPool = new HashMap<T, RouteSpecificPool<T, C, E>>();
         this.leased = new HashSet<E>();
         this.available = new LinkedList<E>();
-        this.pending = new LinkedList<PoolEntryFuture<E>>();
+        this.pending = new LinkedList<Future<E>>();
         this.maxPerRoute = new HashMap<T, Integer>();
     }
 
@@ -183,16 +187,77 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
     public Future<E> lease(final T route, final Object state, final FutureCallback<E> callback) {
         Args.notNull(route, "Route");
         Asserts.check(!this.isShutDown, "Connection pool shut down");
-        return new PoolEntryFuture<E>(this.lock, callback) {
+
+        return new Future<E>() {
+
+            private volatile boolean cancelled;
+            private volatile boolean done;
+            private volatile E entry;
+
+            @Override
+            public boolean cancel(final boolean mayInterruptIfRunning) {
+                cancelled = true;
+                lock.lock();
+                try {
+                    condition.signalAll();
+                } finally {
+                    lock.unlock();
+                }
+                synchronized (this) {
+                    final boolean result = !done;
+                    done = true;
+                    if (callback != null) {
+                        callback.cancelled();
+                    }
+                    return result;
+                }
+            }
+
+            @Override
+            public boolean isCancelled() {
+                return cancelled;
+            }
+
+            @Override
+            public boolean isDone() {
+                return done;
+            }
 
             @Override
-            public E getPoolEntry(
-                    final long timeout,
-                    final TimeUnit tunit)
-                        throws InterruptedException, TimeoutException, IOException {
-                final E entry = getPoolEntryBlocking(route, state, timeout, tunit, this);
-                onLease(entry);
-                return entry;
+            public E get() throws InterruptedException, ExecutionException {
+                try {
+                    return get(0L, TimeUnit.MILLISECONDS);
+                } catch (TimeoutException ex) {
+                    throw new ExecutionException(ex);
+                }
+            }
+
+            @Override
+            public E get(final long timeout, final TimeUnit tunit) throws InterruptedException, ExecutionException, TimeoutException {
+                final E local = entry;
+                if (local != null) {
+                    return local;
+                }
+                synchronized (this) {
+                    try {
+                        if (entry != null) {
+                            return entry;
+                        }
+                        entry = getPoolEntryBlocking(route, state, timeout, tunit, this);
+                        done = true;
+                        onLease(entry);
+                        if (callback != null) {
+                            callback.completed(entry);
+                        }
+                        return entry;
+                    } catch (IOException ex) {
+                        done = true;
+                        if (callback != null) {
+                            callback.failed(ex);
+                        }
+                        throw new ExecutionException(ex);
+                    }
+                }
             }
 
         };
@@ -221,8 +286,7 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
     private E getPoolEntryBlocking(
             final T route, final Object state,
             final long timeout, final TimeUnit tunit,
-            final PoolEntryFuture<E> future)
-                throws IOException, InterruptedException, TimeoutException {
+            final Future<E> future) throws IOException, InterruptedException, TimeoutException {
 
         Date deadline = null;
         if (timeout > 0) {
@@ -302,9 +366,20 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
 
                 boolean success = false;
                 try {
+                    if (future.isCancelled()) {
+                        throw new InterruptedException("Operation interrupted");
+                    }
                     pool.queue(future);
                     this.pending.add(future);
-                    success = future.await(deadline);
+                    if (deadline != null) {
+                        success = this.condition.awaitUntil(deadline);
+                    } else {
+                        this.condition.await();
+                        success = true;
+                    }
+                    if (future.isCancelled()) {
+                        throw new InterruptedException("Operation interrupted");
+                    }
                 } finally {
                     // In case of 'success', we were woken up by the
                     // connection pool and should now have a connection
@@ -338,14 +413,14 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
                     entry.close();
                 }
                 onRelease(entry);
-                PoolEntryFuture<E> future = pool.nextPending();
+                Future<E> future = pool.nextPending();
                 if (future != null) {
                     this.pending.remove(future);
                 } else {
                     future = this.pending.poll();
                 }
                 if (future != null) {
-                    future.wakeup();
+                    this.condition.signalAll();
                 }
             }
         } finally {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/f6b4a9da/httpcore/src/main/java/org/apache/http/pool/PoolEntryFuture.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/pool/PoolEntryFuture.java b/httpcore/src/main/java/org/apache/http/pool/PoolEntryFuture.java
deleted file mode 100644
index 496ad1f..0000000
--- a/httpcore/src/main/java/org/apache/http/pool/PoolEntryFuture.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * ====================================================================
- * 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-package org.apache.http.pool;
-
-import java.io.IOException;
-import java.util.Date;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.Lock;
-
-import org.apache.http.annotation.ThreadingBehavior;
-import org.apache.http.annotation.Contract;
-import org.apache.http.concurrent.FutureCallback;
-import org.apache.http.util.Args;
-
-@Contract(threading = ThreadingBehavior.SAFE_CONDITIONAL)
-abstract class PoolEntryFuture<T> implements Future<T> {
-
-    private final Lock lock;
-    private final FutureCallback<T> callback;
-    private final Condition condition;
-    private volatile boolean cancelled;
-    private volatile boolean completed;
-    private T result;
-
-    PoolEntryFuture(final Lock lock, final FutureCallback<T> callback) {
-        super();
-        this.lock = lock;
-        this.condition = lock.newCondition();
-        this.callback = callback;
-    }
-
-    @Override
-    public boolean cancel(final boolean mayInterruptIfRunning) {
-        this.lock.lock();
-        try {
-            if (this.completed) {
-                return false;
-            }
-            this.completed = true;
-            this.cancelled = true;
-            if (this.callback != null) {
-                this.callback.cancelled();
-            }
-            this.condition.signalAll();
-            return true;
-        } finally {
-            this.lock.unlock();
-        }
-    }
-
-    @Override
-    public boolean isCancelled() {
-        return this.cancelled;
-    }
-
-    @Override
-    public boolean isDone() {
-        return this.completed;
-    }
-
-    @Override
-    public T get() throws InterruptedException, ExecutionException {
-        try {
-            return get(0, TimeUnit.MILLISECONDS);
-        } catch (final TimeoutException ex) {
-            throw new ExecutionException(ex);
-        }
-    }
-
-    @Override
-    public T get(
-            final long timeout,
-            final TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
-        Args.notNull(unit, "Time unit");
-        this.lock.lock();
-        try {
-            if (this.completed) {
-                return this.result;
-            }
-            this.result = getPoolEntry(timeout, unit);
-            this.completed = true;
-            if (this.callback != null) {
-                this.callback.completed(this.result);
-            }
-            return result;
-        } catch (final IOException ex) {
-            this.completed = true;
-            this.result = null;
-            if (this.callback != null) {
-                this.callback.failed(ex);
-            }
-            throw new ExecutionException(ex);
-        } finally {
-            this.lock.unlock();
-        }
-    }
-
-    protected abstract T getPoolEntry(
-            long timeout, TimeUnit unit) throws IOException, InterruptedException, TimeoutException;
-
-    public boolean await(final Date deadline) throws InterruptedException {
-        this.lock.lock();
-        try {
-            if (this.cancelled) {
-                throw new InterruptedException("Operation interrupted");
-            }
-            final boolean success;
-            if (deadline != null) {
-                success = this.condition.awaitUntil(deadline);
-            } else {
-                this.condition.await();
-                success = true;
-            }
-            if (this.cancelled) {
-                throw new InterruptedException("Operation interrupted");
-            }
-            return success;
-        } finally {
-            this.lock.unlock();
-        }
-
-    }
-
-    public void wakeup() {
-        this.lock.lock();
-        try {
-            this.condition.signalAll();
-        } finally {
-            this.lock.unlock();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/f6b4a9da/httpcore/src/main/java/org/apache/http/pool/RouteSpecificPool.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/pool/RouteSpecificPool.java b/httpcore/src/main/java/org/apache/http/pool/RouteSpecificPool.java
index 09bac44..c337228 100644
--- a/httpcore/src/main/java/org/apache/http/pool/RouteSpecificPool.java
+++ b/httpcore/src/main/java/org/apache/http/pool/RouteSpecificPool.java
@@ -30,6 +30,7 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.Set;
+import java.util.concurrent.Future;
 
 import org.apache.http.util.Args;
 import org.apache.http.util.Asserts;
@@ -39,14 +40,14 @@ abstract class RouteSpecificPool<T, C, E extends PoolEntry<T, C>> {
     private final T route;
     private final Set<E> leased;
     private final LinkedList<E> available;
-    private final LinkedList<PoolEntryFuture<E>> pending;
+    private final LinkedList<Future<E>> pending;
 
     RouteSpecificPool(final T route) {
         super();
         this.route = route;
         this.leased = new HashSet<E>();
         this.available = new LinkedList<E>();
-        this.pending = new LinkedList<PoolEntryFuture<E>>();
+        this.pending = new LinkedList<Future<E>>();
     }
 
     protected abstract E createEntry(C conn);
@@ -130,18 +131,18 @@ abstract class RouteSpecificPool<T, C, E extends PoolEntry<T, C>> {
         return entry;
     }
 
-    public void queue(final PoolEntryFuture<E> future) {
+    public void queue(final Future<E> future) {
         if (future == null) {
             return;
         }
         this.pending.add(future);
     }
 
-    public PoolEntryFuture<E> nextPending() {
+    public Future<E> nextPending() {
         return this.pending.poll();
     }
 
-    public void unqueue(final PoolEntryFuture<E> future) {
+    public void unqueue(final Future<E> future) {
         if (future == null) {
             return;
         }
@@ -150,7 +151,7 @@ abstract class RouteSpecificPool<T, C, E extends PoolEntry<T, C>> {
     }
 
     public void shutdown() {
-        for (final PoolEntryFuture<E> future: this.pending) {
+        for (final Future<E> future: this.pending) {
             future.cancel(true);
         }
         this.pending.clear();

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/f6b4a9da/httpcore/src/test/java/org/apache/http/pool/TestRouteSpecificPool.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/pool/TestRouteSpecificPool.java b/httpcore/src/test/java/org/apache/http/pool/TestRouteSpecificPool.java
index 7142fa1..3e48c5e 100644
--- a/httpcore/src/test/java/org/apache/http/pool/TestRouteSpecificPool.java
+++ b/httpcore/src/test/java/org/apache/http/pool/TestRouteSpecificPool.java
@@ -27,6 +27,7 @@
 package org.apache.http.pool;
 
 import java.io.IOException;
+import java.util.concurrent.Future;
 
 import org.apache.http.HttpConnection;
 import org.junit.Assert;
@@ -278,9 +279,9 @@ public class TestRouteSpecificPool {
     public void testWaitingThreadQueuing() throws Exception {
         final LocalRoutePool pool = new LocalRoutePool();
         @SuppressWarnings("unchecked")
-        final PoolEntryFuture<LocalPoolEntry> future1 = Mockito.mock(PoolEntryFuture.class);
+        final Future<LocalPoolEntry> future1 = Mockito.mock(Future.class);
         @SuppressWarnings("unchecked")
-        final PoolEntryFuture<LocalPoolEntry> future2 = Mockito.mock(PoolEntryFuture.class);
+        final Future<LocalPoolEntry> future2 = Mockito.mock(Future.class);
 
         Assert.assertEquals(0, pool.getPendingCount());
         pool.queue(future1);
@@ -308,7 +309,7 @@ public class TestRouteSpecificPool {
         final LocalPoolEntry entry2 = pool.add(conn2);
 
         @SuppressWarnings("unchecked")
-        final PoolEntryFuture<LocalPoolEntry> future1 = Mockito.mock(PoolEntryFuture.class);
+        final Future<LocalPoolEntry> future1 = Mockito.mock(Future.class);
         pool.queue(future1);
 
         Assert.assertNotNull(entry1);


[04/50] httpcomponents-core git commit: HTTPCORE-435: ConnectionConfig#copy() does not copy every field Contributed by Clement Pellerin

Posted by ol...@apache.org.
HTTPCORE-435: ConnectionConfig#copy() does not copy every field
Contributed by Clement Pellerin <clement_pellerin at ibi.com>

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1765101 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/58c75adc
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/58c75adc
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/58c75adc

Branch: refs/heads/4.4.x
Commit: 58c75adc13802cda12177a465acc07c2d73a9f18
Parents: 441c9c4
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Sat Oct 15 19:11:09 2016 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Sat Oct 15 19:11:09 2016 +0000

----------------------------------------------------------------------
 .../src/main/java/org/apache/http/config/ConnectionConfig.java     | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/58c75adc/httpcore/src/main/java/org/apache/http/config/ConnectionConfig.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/config/ConnectionConfig.java b/httpcore/src/main/java/org/apache/http/config/ConnectionConfig.java
index f16b585..761ecfe 100644
--- a/httpcore/src/main/java/org/apache/http/config/ConnectionConfig.java
+++ b/httpcore/src/main/java/org/apache/http/config/ConnectionConfig.java
@@ -117,7 +117,9 @@ public class ConnectionConfig implements Cloneable {
     public static ConnectionConfig.Builder copy(final ConnectionConfig config) {
         Args.notNull(config, "Connection config");
         return new Builder()
+            .setBufferSize(config.getBufferSize())
             .setCharset(config.getCharset())
+            .setFragmentSizeHint(config.getFragmentSizeHint())
             .setMalformedInputAction(config.getMalformedInputAction())
             .setUnmappableInputAction(config.getUnmappableInputAction())
             .setMessageConstraints(config.getMessageConstraints());


[21/50] httpcomponents-core git commit: HTTPCORE-447: HttpHost#create does not throw IllegalArgumentException for empty string

Posted by ol...@apache.org.
HTTPCORE-447: HttpHost#create does not throw IllegalArgumentException for empty string

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1784126 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/2e2d511b
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/2e2d511b
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/2e2d511b

Branch: refs/heads/4.4.x
Commit: 2e2d511b869b01479fc26a21f8a97aab4f828e11
Parents: f7b81af
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Thu Feb 23 13:22:39 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Thu Feb 23 13:22:39 2017 +0000

----------------------------------------------------------------------
 httpcore/src/main/java/org/apache/http/util/Args.java    | 3 +++
 httpcore/src/test/java/org/apache/http/TestHttpHost.java | 5 +++++
 2 files changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/2e2d511b/httpcore/src/main/java/org/apache/http/util/Args.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/util/Args.java b/httpcore/src/main/java/org/apache/http/util/Args.java
index 9eb8a25..6f08674 100644
--- a/httpcore/src/main/java/org/apache/http/util/Args.java
+++ b/httpcore/src/main/java/org/apache/http/util/Args.java
@@ -80,6 +80,9 @@ public class Args {
         if (argument == null) {
             throw new IllegalArgumentException(name + " may not be null");
         }
+        if (argument.length() == 0) {
+            throw new IllegalArgumentException(name + " may not be empty");
+        }
         if (TextUtils.containsBlanks(argument)) {
             throw new IllegalArgumentException(name + " may not contain blanks");
         }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/2e2d511b/httpcore/src/test/java/org/apache/http/TestHttpHost.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/TestHttpHost.java b/httpcore/src/test/java/org/apache/http/TestHttpHost.java
index 71f161b..674d9e3 100644
--- a/httpcore/src/test/java/org/apache/http/TestHttpHost.java
+++ b/httpcore/src/test/java/org/apache/http/TestHttpHost.java
@@ -222,6 +222,11 @@ public class TestHttpHost {
             Assert.fail("IllegalArgumentException expected");
         } catch (final IllegalArgumentException expected) {
         }
+        try {
+            HttpHost.create("");
+            Assert.fail("IllegalArgumentException expected");
+        } catch (final IllegalArgumentException expected) {
+        }
     }
 
 }


[15/50] httpcomponents-core git commit: Refactor magic number.

Posted by ol...@apache.org.
Refactor magic number.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1778357 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/5f800413
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/5f800413
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/5f800413

Branch: refs/heads/4.4.x
Commit: 5f800413a371dcb07e794e8d03cafad8b2d65110
Parents: a15ca59
Author: Gary D. Gregory <gg...@apache.org>
Authored: Wed Jan 11 23:44:17 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Wed Jan 11 23:44:17 2017 +0000

----------------------------------------------------------------------
 httpcore/src/main/java/org/apache/http/util/EntityUtils.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5f800413/httpcore/src/main/java/org/apache/http/util/EntityUtils.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/util/EntityUtils.java b/httpcore/src/main/java/org/apache/http/util/EntityUtils.java
index 83297f0..e401f4e 100644
--- a/httpcore/src/main/java/org/apache/http/util/EntityUtils.java
+++ b/httpcore/src/main/java/org/apache/http/util/EntityUtils.java
@@ -50,6 +50,8 @@ import org.apache.http.protocol.HTTP;
  */
 public final class EntityUtils {
 
+    private static final int DEFAULT_BUFFER_SIZE = 4096;
+
     private EntityUtils() {
     }
 
@@ -128,10 +130,10 @@ public final class EntityUtils {
                     "HTTP entity too large to be buffered in memory");
             int i = (int)entity.getContentLength();
             if (i < 0) {
-                i = 4096;
+                i = DEFAULT_BUFFER_SIZE;
             }
             final ByteArrayBuffer buffer = new ByteArrayBuffer(i);
-            final byte[] tmp = new byte[4096];
+            final byte[] tmp = new byte[DEFAULT_BUFFER_SIZE];
             int l;
             while((l = instream.read(tmp)) != -1) {
                 buffer.append(tmp, 0, l);
@@ -205,7 +207,7 @@ public final class EntityUtils {
                     "HTTP entity too large to be buffered in memory");
             int i = (int)entity.getContentLength();
             if (i < 0) {
-                i = 4096;
+                i = DEFAULT_BUFFER_SIZE;
             }
             Charset charset = null;
             if (contentType != null) {


[39/50] httpcomponents-core git commit: HTTPCORE-461: Add factory methods to DefaultHttpServerIODispatch to handle a null SSLContext.

Posted by ol...@apache.org.
HTTPCORE-461: Add factory methods to DefaultHttpServerIODispatch to handle a null SSLContext.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1793919 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/0ee4ac36
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/0ee4ac36
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/0ee4ac36

Branch: refs/heads/4.4.x
Commit: 0ee4ac36f7da00499a44aaa51a97a3f415871b46
Parents: 5ca20d3
Author: Gary D. Gregory <gg...@apache.org>
Authored: Thu May 4 22:42:10 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Thu May 4 22:42:10 2017 +0000

----------------------------------------------------------------------
 RELEASE_NOTES.txt                               |  3 ++
 .../impl/nio/DefaultHttpServerIODispatch.java   | 38 +++++++++++++++++++-
 2 files changed, 40 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/0ee4ac36/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 4a3ea93..a3c75af 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -12,6 +12,9 @@ Changelog
 * HTTPCORE-460: Add factory methods to DefaultHttpClientIODispatch to handle a null SSLContext.
   Contributed by Gary Gregory <ggregory at apache.org>
 
+* HTTPCORE-461: Add factory methods to DefaultHttpServerIODispatch to handle a null SSLContext.
+  Contributed by Gary Gregory <ggregory at apache.org>
+
 
 Release 4.4.6
 -------------------

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/0ee4ac36/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
index a49b1b3..3a1621b 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
@@ -31,8 +31,8 @@ import java.io.IOException;
 
 import javax.net.ssl.SSLContext;
 
-import org.apache.http.annotation.ThreadingBehavior;
 import org.apache.http.annotation.Contract;
+import org.apache.http.annotation.ThreadingBehavior;
 import org.apache.http.config.ConnectionConfig;
 import org.apache.http.impl.nio.reactor.AbstractIODispatch;
 import org.apache.http.nio.NHttpConnectionFactory;
@@ -54,6 +54,42 @@ import org.apache.http.util.Args;
 public class DefaultHttpServerIODispatch
                     extends AbstractIODispatch<DefaultNHttpServerConnection> {
 
+    /**
+     * Creates a new instance of this class to be used for dispatching I/O event
+     * notifications to the given protocol handler.
+     *
+     * @param handler the client protocol handler.
+     * @param sslContext an SSLContext or null (for a plain text connection.)
+     * @param config a connection configuration
+     * @return a new instance
+     * @since 4.4.7
+     */
+    public static DefaultHttpServerIODispatch create(final NHttpServerEventHandler handler,
+            final SSLContext sslContext,
+            final ConnectionConfig config) {
+        return sslContext == null ? new DefaultHttpServerIODispatch(handler, config)
+                : new DefaultHttpServerIODispatch(handler, sslContext, config);
+    }
+
+    /**
+     * Creates a new instance of this class to be used for dispatching I/O event
+     * notifications to the given protocol handler.
+     *
+     * @param handler the client protocol handler.
+     * @param sslContext an SSLContext or null (for a plain text connection.)
+     * @param sslHandler customizes various aspects of the TLS/SSL protocol.
+     * @param config a connection configuration
+     * @return a new instance
+     * @since 4.4.7
+     */
+    public static DefaultHttpServerIODispatch create(final NHttpServerEventHandler handler,
+            final SSLContext sslContext,
+            final SSLSetupHandler sslHandler,
+            final ConnectionConfig config) {
+        return sslContext == null ? new DefaultHttpServerIODispatch(handler, config)
+                : new DefaultHttpServerIODispatch(handler, sslContext, sslHandler, config);
+    }
+
     private final NHttpServerEventHandler handler;
     private final NHttpConnectionFactory<? extends DefaultNHttpServerConnection> connFactory;
 


[06/50] httpcomponents-core git commit: HTTPCORE-433: moved expensive connection validation code outside the pool lock

Posted by ol...@apache.org.
HTTPCORE-433: moved expensive connection validation code outside the pool lock

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1770883 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/2af83590
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/2af83590
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/2af83590

Branch: refs/heads/4.4.x
Commit: 2af8359060e5ee534243003210c43e43197b5ca2
Parents: f6b4a9d
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Tue Nov 22 20:30:32 2016 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Tue Nov 22 20:30:32 2016 +0000

----------------------------------------------------------------------
 .../org/apache/http/pool/AbstractConnPool.java  | 47 ++++++++++----------
 .../java/org/apache/http/pool/PoolEntry.java    |  3 +-
 .../java/org/apache/http/pool/TestConnPool.java |  4 +-
 3 files changed, 27 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/2af83590/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java b/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
index 51b0453..d34cf24 100644
--- a/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
+++ b/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
@@ -234,22 +234,30 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
 
             @Override
             public E get(final long timeout, final TimeUnit tunit) throws InterruptedException, ExecutionException, TimeoutException {
-                final E local = entry;
-                if (local != null) {
-                    return local;
+                if (entry != null) {
+                    return entry;
                 }
                 synchronized (this) {
                     try {
-                        if (entry != null) {
+                        for (;;) {
+                            final E leasedEntry = getPoolEntryBlocking(route, state, timeout, tunit, this);
+                            if (validateAfterInactivity > 0)  {
+                                if (leasedEntry.getUpdated() + validateAfterInactivity <= System.currentTimeMillis()) {
+                                    if (!validate(leasedEntry)) {
+                                        leasedEntry.close();
+                                        release(leasedEntry, false);
+                                        continue;
+                                    }
+                                }
+                            }
+                            entry = leasedEntry;
+                            done = true;
+                            onLease(entry);
+                            if (callback != null) {
+                                callback.completed(entry);
+                            }
                             return entry;
                         }
-                        entry = getPoolEntryBlocking(route, state, timeout, tunit, this);
-                        done = true;
-                        onLease(entry);
-                        if (callback != null) {
-                            callback.completed(entry);
-                        }
-                        return entry;
                     } catch (IOException ex) {
                         done = true;
                         if (callback != null) {
@@ -290,15 +298,13 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
 
         Date deadline = null;
         if (timeout > 0) {
-            deadline = new Date
-                (System.currentTimeMillis() + tunit.toMillis(timeout));
+            deadline = new Date (System.currentTimeMillis() + tunit.toMillis(timeout));
         }
-
         this.lock.lock();
         try {
             final RouteSpecificPool<T, C, E> pool = getPool(route);
-            E entry = null;
-            while (entry == null) {
+            E entry;
+            for (;;) {
                 Asserts.check(!this.isShutDown, "Connection pool shut down");
                 for (;;) {
                     entry = pool.getFree(state);
@@ -307,12 +313,6 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
                     }
                     if (entry.isExpired(System.currentTimeMillis())) {
                         entry.close();
-                    } else if (this.validateAfterInactivity > 0) {
-                        if (entry.getUpdated() + this.validateAfterInactivity <= System.currentTimeMillis()) {
-                            if (!validate(entry)) {
-                                entry.close();
-                            }
-                        }
                     }
                     if (entry.isClosed()) {
                         this.available.remove(entry);
@@ -389,8 +389,7 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
                     this.pending.remove(future);
                 }
                 // check for spurious wakeup vs. timeout
-                if (!success && (deadline != null) &&
-                    (deadline.getTime() <= System.currentTimeMillis())) {
+                if (!success && (deadline != null && deadline.getTime() <= System.currentTimeMillis())) {
                     break;
                 }
             }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/2af83590/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java b/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java
index e334e24..31b8ee2 100644
--- a/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java
+++ b/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java
@@ -28,8 +28,8 @@ package org.apache.http.pool;
 
 import java.util.concurrent.TimeUnit;
 
-import org.apache.http.annotation.ThreadingBehavior;
 import org.apache.http.annotation.Contract;
+import org.apache.http.annotation.ThreadingBehavior;
 import org.apache.http.util.Args;
 
 /**
@@ -83,6 +83,7 @@ public abstract class PoolEntry<T, C> {
         this.route = route;
         this.conn = conn;
         this.created = System.currentTimeMillis();
+        this.updated = this.created;
         if (timeToLive > 0) {
             this.validityDeadline = this.created + tunit.toMillis(timeToLive);
         } else {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/2af83590/httpcore/src/test/java/org/apache/http/pool/TestConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/pool/TestConnPool.java b/httpcore/src/test/java/org/apache/http/pool/TestConnPool.java
index 24c2fa1..75ebb26 100644
--- a/httpcore/src/test/java/org/apache/http/pool/TestConnPool.java
+++ b/httpcore/src/test/java/org/apache/http/pool/TestConnPool.java
@@ -806,7 +806,7 @@ public class TestConnPool {
         Mockito.when(connFactory.create(Mockito.eq("somehost"))).thenReturn(conn);
 
         final LocalConnPool pool = new LocalConnPool(connFactory, 2, 10);
-        pool.setValidateAfterInactivity(5);
+        pool.setValidateAfterInactivity(100);
 
         final Future<LocalPoolEntry> future1 = pool.lease("somehost", null);
         final LocalPoolEntry entry1 = future1.get(1, TimeUnit.SECONDS);
@@ -814,7 +814,7 @@ public class TestConnPool {
 
         pool.release(entry1, true);
 
-        Thread.sleep(10);
+        Thread.sleep(150);
 
         final Future<LocalPoolEntry> future2 = pool.lease("somehost", null);
         final LocalPoolEntry entry2 = future2.get(1, TimeUnit.SECONDS);


[38/50] httpcomponents-core git commit: HTTPCORE-460: Add factory methods to DefaultHttpClientIODispatch to handle a null SSLContext.

Posted by ol...@apache.org.
HTTPCORE-460: Add factory methods to DefaultHttpClientIODispatch to handle a null SSLContext.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1793918 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/5ca20d37
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/5ca20d37
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/5ca20d37

Branch: refs/heads/4.4.x
Commit: 5ca20d3784284ede5c661eeb40ac6fd0790a250e
Parents: c5295f7
Author: Gary D. Gregory <gg...@apache.org>
Authored: Thu May 4 22:41:22 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Thu May 4 22:41:22 2017 +0000

----------------------------------------------------------------------
 RELEASE_NOTES.txt                               |  3 ++
 .../impl/nio/DefaultHttpClientIODispatch.java   | 38 +++++++++++++++++++-
 2 files changed, 40 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ca20d37/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 46173c4..4a3ea93 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -9,6 +9,9 @@ Changelog
 * HTTPCORE-450: Add a Provider parameter in SSLContextBuilder.
   Contributed by lujianbo <387852424 at qq dot com>, Gary Gregory <ggregory at apache.org>
 
+* HTTPCORE-460: Add factory methods to DefaultHttpClientIODispatch to handle a null SSLContext.
+  Contributed by Gary Gregory <ggregory at apache.org>
+
 
 Release 4.4.6
 -------------------

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ca20d37/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
index cfc0a10..44935b0 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
@@ -31,8 +31,8 @@ import java.io.IOException;
 
 import javax.net.ssl.SSLContext;
 
-import org.apache.http.annotation.ThreadingBehavior;
 import org.apache.http.annotation.Contract;
+import org.apache.http.annotation.ThreadingBehavior;
 import org.apache.http.config.ConnectionConfig;
 import org.apache.http.impl.nio.reactor.AbstractIODispatch;
 import org.apache.http.nio.NHttpClientEventHandler;
@@ -54,6 +54,42 @@ import org.apache.http.util.Args;
 public class DefaultHttpClientIODispatch
                     extends AbstractIODispatch<DefaultNHttpClientConnection> {
 
+    /**
+     * Creates a new instance of this class to be used for dispatching I/O event
+     * notifications to the given protocol handler.
+     *
+     * @param handler the client protocol handler.
+     * @param sslContext an SSLContext or null (for a plain text connection.)
+     * @param config a connection configuration
+     * @return a new instance
+     * @since 4.4.7
+     */
+    public static DefaultHttpClientIODispatch create(final NHttpClientEventHandler handler,
+            final SSLContext sslContext,
+            final ConnectionConfig config) {
+        return sslContext == null ? new DefaultHttpClientIODispatch(handler, config)
+                : new DefaultHttpClientIODispatch(handler, sslContext, config);
+    }
+
+    /**
+     * Creates a new instance of this class to be used for dispatching I/O event
+     * notifications to the given protocol handler.
+     *
+     * @param handler the client protocol handler.
+     * @param sslContext an SSLContext or null (for a plain text connection.)
+     * @param sslHandler customizes various aspects of the TLS/SSL protocol.
+     * @param config a connection configuration
+     * @return a new instance
+     * @since 4.4.7
+     */
+    public static DefaultHttpClientIODispatch create(final NHttpClientEventHandler handler,
+            final SSLContext sslContext,
+            final SSLSetupHandler sslHandler,
+            final ConnectionConfig config) {
+        return sslContext == null ? new DefaultHttpClientIODispatch(handler, config)
+                : new DefaultHttpClientIODispatch(handler, sslContext, sslHandler, config);
+    }
+
     private final NHttpClientEventHandler handler;
     private final NHttpConnectionFactory<DefaultNHttpClientConnection> connFactory;
 


[19/50] httpcomponents-core git commit: HTTPASYNC-116: Remove cancelled lease requests from the request queue when validating pending requests

Posted by ol...@apache.org.
HTTPASYNC-116: Remove cancelled lease requests from the request queue when validating pending requests

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1780653 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/217e68e0
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/217e68e0
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/217e68e0

Branch: refs/heads/4.4.x
Commit: 217e68e0c486cd51817fad6fb97eb55640256451
Parents: e555fab
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Sat Jan 28 10:34:41 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Sat Jan 28 10:34:41 2017 +0000

----------------------------------------------------------------------
 .../apache/http/nio/pool/AbstractNIOConnPool.java    | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/217e68e0/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java b/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
index b4ee96d..603b71d 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
@@ -484,11 +484,18 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
             final ListIterator<LeaseRequest<T, C, E>> it = this.leasingRequests.listIterator();
             while (it.hasNext()) {
                 final LeaseRequest<T, C, E> request = it.next();
-                final long deadline = request.getDeadline();
-                if (now > deadline) {
+                final BasicFuture<E> future = request.getFuture();
+                if (future.isCancelled() && !request.isDone()) {
                     it.remove();
-                    request.failed(new TimeoutException());
-                    this.completedRequests.add(request);
+                } else {
+                    final long deadline = request.getDeadline();
+                    if (now > deadline) {
+                        request.failed(new TimeoutException());
+                    }
+                    if (request.isDone()) {
+                        it.remove();
+                        this.completedRequests.add(request);
+                    }
                 }
             }
         } finally {


[07/50] httpcomponents-core git commit: Fixed possible connection leak due to cancellation of connection requests

Posted by ol...@apache.org.
Fixed possible connection leak due to cancellation of connection requests

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1772394 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/141eacdb
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/141eacdb
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/141eacdb

Branch: refs/heads/4.4.x
Commit: 141eacdba429c0e37c7f4477a49974c96f4c7c83
Parents: 2af8359
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Fri Dec 2 18:53:34 2016 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri Dec 2 18:53:34 2016 +0000

----------------------------------------------------------------------
 .../http/nio/pool/AbstractNIOConnPool.java      | 32 +++++++--
 .../apache/http/nio/pool/RouteSpecificPool.java |  4 +-
 .../apache/http/nio/pool/TestNIOConnPool.java   | 68 +++++++++++++++++++-
 3 files changed, 96 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/141eacdb/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java b/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
index 9cae419..02533ba 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
@@ -43,8 +43,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 
-import org.apache.http.annotation.ThreadingBehavior;
 import org.apache.http.annotation.Contract;
+import org.apache.http.annotation.ThreadingBehavior;
 import org.apache.http.concurrent.BasicFuture;
 import org.apache.http.concurrent.FutureCallback;
 import org.apache.http.nio.reactor.ConnectingIOReactor;
@@ -327,6 +327,11 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
         final ListIterator<LeaseRequest<T, C, E>> it = this.leasingRequests.listIterator();
         while (it.hasNext()) {
             final LeaseRequest<T, C, E> request = it.next();
+            final BasicFuture<E> future = request.getFuture();
+            if (future.isCancelled()) {
+                it.remove();
+                continue;
+            }
             final boolean completed = processPendingRequest(request);
             if (request.isDone() || completed) {
                 it.remove();
@@ -341,6 +346,11 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
         final ListIterator<LeaseRequest<T, C, E>> it = this.leasingRequests.listIterator();
         while (it.hasNext()) {
             final LeaseRequest<T, C, E> request = it.next();
+            final BasicFuture<E> future = request.getFuture();
+            if (future.isCancelled()) {
+                it.remove();
+                continue;
+            }
             final boolean completed = processPendingRequest(request);
             if (request.isDone() || completed) {
                 it.remove();
@@ -450,13 +460,19 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
             final BasicFuture<E> future = request.getFuture();
             final Exception ex = request.getException();
             final E result = request.getResult();
+            boolean successfullyCompleted = false;
             if (ex != null) {
                 future.failed(ex);
             } else if (result != null) {
-                future.completed(result);
+                if (future.completed(result)) {
+                    successfullyCompleted = true;
+                }
             } else {
                 future.cancel();
             }
+            if (!successfullyCompleted) {
+                release(result, true);
+            }
         }
     }
 
@@ -495,9 +511,15 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
             try {
                 final C conn = this.connFactory.create(route, session);
                 final E entry = pool.createEntry(request, conn);
-                this.leased.add(entry);
-                pool.completed(request, entry);
-                onLease(entry);
+                if (pool.completed(request, entry)) {
+                    this.leased.add(entry);
+                    onLease(entry);
+                } else {
+                    this.available.add(entry);
+                    if (this.ioreactor.getStatus().compareTo(IOReactorStatus.ACTIVE) <= 0) {
+                        processNextPendingRequest();
+                    }
+                }
             } catch (final IOException ex) {
                 pool.failed(request, ex);
             }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/141eacdb/httpcore-nio/src/main/java/org/apache/http/nio/pool/RouteSpecificPool.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/pool/RouteSpecificPool.java b/httpcore-nio/src/main/java/org/apache/http/nio/pool/RouteSpecificPool.java
index eb9fa0f..7e9a240 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/pool/RouteSpecificPool.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/pool/RouteSpecificPool.java
@@ -148,9 +148,9 @@ abstract class RouteSpecificPool<T, C, E extends PoolEntry<T, C>> {
         return entry;
     }
 
-    public void completed(final SessionRequest request, final E entry) {
+    public boolean completed(final SessionRequest request, final E entry) {
         final BasicFuture<E> future = removeRequest(request);
-        future.completed(entry);
+        return future.completed(entry);
     }
 
     public void cancelled(final SessionRequest request) {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/141eacdb/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java b/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
index be0d2f7..859d547 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
@@ -27,9 +27,9 @@
 package org.apache.http.nio.pool;
 
 import java.io.IOException;
+import java.net.ConnectException;
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
-import java.net.ConnectException;
 import java.net.UnknownHostException;
 import java.util.Collections;
 import java.util.concurrent.ExecutionException;
@@ -1023,4 +1023,70 @@ public class TestNIOConnPool {
         pool.requestTimeout(Mockito.mock(SessionRequest.class));
     }
 
+    @Test
+    public void testLeaseRequestCanceled() throws Exception {
+        final IOSession iosession1 = Mockito.mock(IOSession.class);
+        Mockito.when(iosession1.isClosed()).thenReturn(Boolean.TRUE);
+        final SessionRequest sessionRequest1 = Mockito.mock(SessionRequest.class);
+        Mockito.when(sessionRequest1.getAttachment()).thenReturn("somehost");
+        Mockito.when(sessionRequest1.getSession()).thenReturn(iosession1);
+
+        final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
+        Mockito.when(ioreactor.connect(
+                Mockito.any(SocketAddress.class), Mockito.any(SocketAddress.class),
+                Mockito.any(), Mockito.any(SessionRequestCallback.class))).
+                thenReturn(sessionRequest1);
+        Mockito.when(ioreactor.getStatus()).thenReturn(IOReactorStatus.ACTIVE);
+
+        final LocalSessionPool pool = new LocalSessionPool(ioreactor, 1, 1);
+
+        final Future<LocalPoolEntry> future1 = pool.lease("somehost", null, 0, TimeUnit.MILLISECONDS, null);
+        future1.cancel(true);
+
+        pool.requestCompleted(sessionRequest1);
+
+        Assert.assertTrue(future1.isDone());
+        final LocalPoolEntry entry1 = future1.get();
+        Assert.assertNull(entry1);
+
+        final PoolStats totals = pool.getTotalStats();
+        Assert.assertEquals(1, totals.getAvailable());
+        Assert.assertEquals(0, totals.getLeased());
+    }
+
+    @Test
+    public void testLeaseRequestCanceledWhileConnecting() throws Exception {
+        final IOSession iosession1 = Mockito.mock(IOSession.class);
+        Mockito.when(iosession1.isClosed()).thenReturn(Boolean.TRUE);
+        final SessionRequest sessionRequest1 = Mockito.mock(SessionRequest.class);
+        Mockito.when(sessionRequest1.getAttachment()).thenReturn("somehost");
+        Mockito.when(sessionRequest1.getSession()).thenReturn(iosession1);
+
+        final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
+        Mockito.when(ioreactor.connect(
+                Mockito.any(SocketAddress.class), Mockito.any(SocketAddress.class),
+                Mockito.any(), Mockito.any(SessionRequestCallback.class))).
+                thenReturn(sessionRequest1);
+        Mockito.when(ioreactor.getStatus()).thenReturn(IOReactorStatus.ACTIVE);
+
+        final LocalSessionPool pool = new LocalSessionPool(ioreactor, 1, 1);
+
+        final Future<LocalPoolEntry> future1 = pool.lease("somehost", null, 0, TimeUnit.MILLISECONDS, null);
+
+        pool.requestCompleted(sessionRequest1);
+
+        Assert.assertTrue(future1.isDone());
+        final LocalPoolEntry entry1 = future1.get();
+        Assert.assertNotNull(entry1);
+
+        final Future<LocalPoolEntry> future2 = pool.lease("somehost", null, 0, TimeUnit.MILLISECONDS, null);
+        future2.cancel(true);
+
+        pool.release(entry1, true);
+
+        final PoolStats totals = pool.getTotalStats();
+        Assert.assertEquals(1, totals.getAvailable());
+        Assert.assertEquals(0, totals.getLeased());
+    }
+
 }


[24/50] httpcomponents-core git commit: [HTTPCORE-450] Add a Provider parameter in SSLContextBuilder.

Posted by ol...@apache.org.
[HTTPCORE-450] Add a Provider parameter in SSLContextBuilder.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1790053 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/d2ac506f
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/d2ac506f
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/d2ac506f

Branch: refs/heads/4.4.x
Commit: d2ac506f990911c56a19ae94f78daddd18dff494
Parents: 0962ff4
Author: Gary D. Gregory <gg...@apache.org>
Authored: Mon Apr 3 22:13:57 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Mon Apr 3 22:13:57 2017 +0000

----------------------------------------------------------------------
 RELEASE_NOTES.txt                                   | 12 ++++++++++++
 .../java/org/apache/http/ssl/SSLContextBuilder.java | 16 ++++++++++++++--
 .../org/apache/http/ssl/TestSSLContextBuilder.java  | 13 +++++++++++++
 3 files changed, 39 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d2ac506f/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index d4e9264..46173c4 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,3 +1,15 @@
+Release 4.4.7
+-------------------
+
+This is a maintenance release that fixes a number of issues discovered since 4.4.6.
+
+Changelog
+-------------------
+
+* HTTPCORE-450: Add a Provider parameter in SSLContextBuilder.
+  Contributed by lujianbo <387852424 at qq dot com>, Gary Gregory <ggregory at apache.org>
+
+
 Release 4.4.6
 -------------------
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d2ac506f/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
index 067a0c4..2fe30b9 100644
--- a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
+++ b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
@@ -39,6 +39,7 @@ import java.security.KeyStoreException;
 import java.security.NoSuchAlgorithmException;
 import java.security.Principal;
 import java.security.PrivateKey;
+import java.security.Provider;
 import java.security.SecureRandom;
 import java.security.UnrecoverableKeyException;
 import java.security.cert.CertificateException;
@@ -80,6 +81,7 @@ public class SSLContextBuilder {
     private final Set<KeyManager> keymanagers;
     private final Set<TrustManager> trustmanagers;
     private SecureRandom secureRandom;
+    private Provider provider;
 
     public static SSLContextBuilder create() {
         return new SSLContextBuilder();
@@ -101,6 +103,11 @@ public class SSLContextBuilder {
         return this;
     }
 
+    public SSLContextBuilder setProvider(final Provider provider) {
+        this.provider = provider;
+        return this;
+    }
+
     public SSLContextBuilder loadTrustMaterial(
             final KeyStore truststore,
             final TrustStrategy trustStrategy) throws NoSuchAlgorithmException, KeyStoreException {
@@ -266,8 +273,13 @@ public class SSLContextBuilder {
     }
 
     public SSLContext build() throws NoSuchAlgorithmException, KeyManagementException {
-        final SSLContext sslcontext = SSLContext.getInstance(
-                this.protocol != null ? this.protocol : TLS);
+        final SSLContext sslcontext;
+        final String protocolStr = this.protocol != null ? this.protocol : TLS;
+        if (this.provider != null) {
+            sslcontext = SSLContext.getInstance(protocolStr, this.provider);
+        } else {
+            sslcontext = SSLContext.getInstance(protocolStr);
+        }
         initSSLContext(sslcontext, keymanagers, trustmanagers, secureRandom);
         return sslcontext;
     }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d2ac506f/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java b/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
index 61992be..ae132f0 100644
--- a/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
+++ b/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
@@ -37,6 +37,7 @@ import java.net.SocketException;
 import java.net.URL;
 import java.security.KeyStore;
 import java.security.Principal;
+import java.security.Security;
 import java.security.UnrecoverableKeyException;
 import java.security.cert.CertificateException;
 import java.security.cert.X509Certificate;
@@ -618,4 +619,16 @@ public class TestSSLContextBuilder {
         }
     }
 
+    @Test
+    public void testBuildWithProvider() throws Exception {
+        final URL resource1 = getClass().getResource("/test-server.keystore");
+        final String storePassword = "nopassword";
+        final String keyPassword = "nopassword";
+        final SSLContext sslContext=SSLContextBuilder.create()
+                .setProvider(Security.getProvider("SunJSSE"))
+                .loadKeyMaterial(resource1, storePassword.toCharArray(), keyPassword.toCharArray())
+                .build();
+        Assert.assertTrue(sslContext.getProvider().getName().equals("SunJSSE"));
+    }
+
 }


[27/50] httpcomponents-core git commit: HTTPCORE-455: fatal Error in an individual worker thread does not cause proper I/O reactor shutdown

Posted by ol...@apache.org.
HTTPCORE-455: fatal Error in an individual worker thread does not cause proper I/O reactor shutdown

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1792524 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/efb11b8f
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/efb11b8f
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/efb11b8f

Branch: refs/heads/4.4.x
Commit: efb11b8fd0b54dab147f3c4f63eebf62ae11863c
Parents: bde8ec2
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Mon Apr 24 18:10:17 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Mon Apr 24 18:10:17 2017 +0000

----------------------------------------------------------------------
 .../http/impl/nio/reactor/AbstractMultiworkerIOReactor.java | 9 ++++++---
 .../org/apache/http/nio/reactor/IOReactorException.java     | 7 +++++++
 2 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/efb11b8f/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
index 020804d..44830b6 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
@@ -351,7 +351,7 @@ public abstract class AbstractMultiworkerIOReactor implements IOReactor {
                 // Verify I/O dispatchers
                 for (int i = 0; i < this.workerCount; i++) {
                     final Worker worker = this.workers[i];
-                    final Exception ex = worker.getException();
+                    final Throwable ex = worker.getThrowable();
                     if (ex != null) {
                         throw new IOReactorException(
                                 "I/O dispatch worker terminated abnormally", ex);
@@ -574,7 +574,7 @@ public abstract class AbstractMultiworkerIOReactor implements IOReactor {
         final BaseIOReactor dispatcher;
         final IOEventDispatch eventDispatch;
 
-        private volatile Exception exception;
+        private volatile Throwable exception;
 
         public Worker(final BaseIOReactor dispatcher, final IOEventDispatch eventDispatch) {
             super();
@@ -586,12 +586,15 @@ public abstract class AbstractMultiworkerIOReactor implements IOReactor {
         public void run() {
             try {
                 this.dispatcher.execute(this.eventDispatch);
+            } catch (final Error ex) {
+                this.exception = ex;
+                throw ex;
             } catch (final Exception ex) {
                 this.exception = ex;
             }
         }
 
-        public Exception getException() {
+        public Throwable getThrowable() {
             return this.exception;
         }
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/efb11b8f/httpcore-nio/src/main/java/org/apache/http/nio/reactor/IOReactorException.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/IOReactorException.java b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/IOReactorException.java
index f3cfe19..917b26a 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/IOReactorException.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/IOReactorException.java
@@ -46,6 +46,13 @@ public class IOReactorException extends IOException {
         }
     }
 
+    public IOReactorException(final String message, final Throwable cause) {
+        super(message);
+        if (cause != null) {
+            initCause(cause);
+        }
+    }
+
     public IOReactorException(final String message) {
         super(message);
     }


[22/50] httpcomponents-core git commit: Use final.

Posted by ol...@apache.org.
Use final.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1788706 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/b7cbb794
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/b7cbb794
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/b7cbb794

Branch: refs/heads/4.4.x
Commit: b7cbb7943e0f4398864198b9dc9fe37b0dc151c9
Parents: 2e2d511
Author: Gary D. Gregory <gg...@apache.org>
Authored: Sun Mar 26 02:26:35 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Sun Mar 26 02:26:35 2017 +0000

----------------------------------------------------------------------
 .../org/apache/http/nio/pool/AbstractNIOConnPool.java     |  2 +-
 .../org/apache/http/nio/reactor/ssl/SSLIOSession.java     |  2 +-
 .../org/apache/http/impl/nio/codecs/TestChunkDecoder.java |  8 ++++----
 .../http/impl/nio/reactor/TestSessionInOutBuffers.java    |  4 ++--
 .../nio/integration/TestClientOutOfSequenceResponse.java  |  2 +-
 .../nio/integration/TestHttpAsyncHandlersPipelining.java  | 10 +++++-----
 .../org/apache/http/nio/testserver/HttpClientNio.java     |  2 +-
 .../src/main/java/org/apache/http/entity/ContentType.java |  2 +-
 .../main/java/org/apache/http/pool/AbstractConnPool.java  |  4 ++--
 9 files changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b7cbb794/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java b/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
index 603b71d..77824b4 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
@@ -691,7 +691,7 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
         try {
             final RouteSpecificPool<T, C, E> pool = getPool(route);
             int pendingCount = 0;
-            for (LeaseRequest<T, C, E> request: leasingRequests) {
+            for (final LeaseRequest<T, C, E> request: leasingRequests) {
                 if (LangUtils.equals(route, request.getRoute())) {
                     pendingCount++;
                 }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b7cbb794/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
index a84d1ff..e47cf11 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
@@ -637,7 +637,7 @@ public class SSLIOSession implements IOSession, SessionBufferStatus, SocketAcces
         this.sslEngine.closeOutbound();
         try {
             updateEventMask();
-        } catch (CancelledKeyException ex) {
+        } catch (final CancelledKeyException ex) {
             shutdown();
         }
     }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b7cbb794/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestChunkDecoder.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestChunkDecoder.java b/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestChunkDecoder.java
index 97bf84e..40ecabe 100644
--- a/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestChunkDecoder.java
+++ b/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestChunkDecoder.java
@@ -433,7 +433,7 @@ public class TestChunkDecoder {
         try {
             decoder2.read(dst);
             Assert.fail("MessageConstraintException expected");
-        } catch (MessageConstraintException ex) {
+        } catch (final MessageConstraintException ex) {
         }
     }
 
@@ -470,7 +470,7 @@ public class TestChunkDecoder {
         try {
             decoder2.read(dst);
             Assert.fail("MessageConstraintException expected");
-        } catch (MessageConstraintException ex) {
+        } catch (final MessageConstraintException ex) {
         }
     }
 
@@ -506,7 +506,7 @@ public class TestChunkDecoder {
         try {
             decoder2.read(dst);
             Assert.fail("MessageConstraintException expected");
-        } catch (MessageConstraintException ex) {
+        } catch (final MessageConstraintException ex) {
         }
     }
 
@@ -543,7 +543,7 @@ public class TestChunkDecoder {
         try {
             decoder2.read(dst);
             Assert.fail("MessageConstraintException expected");
-        } catch (MessageConstraintException ex) {
+        } catch (final MessageConstraintException ex) {
         }
     }
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b7cbb794/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestSessionInOutBuffers.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestSessionInOutBuffers.java b/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestSessionInOutBuffers.java
index b9df858..89f6c54 100644
--- a/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestSessionInOutBuffers.java
+++ b/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestSessionInOutBuffers.java
@@ -153,7 +153,7 @@ public class TestSessionInOutBuffers {
         try {
             inbuf2.readLine(line, false);
             Assert.fail("MessageConstraintException expected");
-        } catch (MessageConstraintException ex) {
+        } catch (final MessageConstraintException ex) {
         }
     }
 
@@ -176,7 +176,7 @@ public class TestSessionInOutBuffers {
         try {
             inbuf2.readLine(line, false);
             Assert.fail("MessageConstraintException expected");
-        } catch (MessageConstraintException ex) {
+        } catch (final MessageConstraintException ex) {
         }
     }
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b7cbb794/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestClientOutOfSequenceResponse.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestClientOutOfSequenceResponse.java b/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestClientOutOfSequenceResponse.java
index 52edb53..ff87f20 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestClientOutOfSequenceResponse.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestClientOutOfSequenceResponse.java
@@ -99,7 +99,7 @@ public class TestClientOutOfSequenceResponse {
         try {
             final HttpResponse response2 = future2.get();
             Assert.assertEquals(200, response2.getStatusLine().getStatusCode());
-        } catch (ExecutionException ex) {
+        } catch (final ExecutionException ex) {
             Assert.assertTrue(ex.getCause() instanceof HttpException);
         }
     }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b7cbb794/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlersPipelining.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlersPipelining.java b/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlersPipelining.java
index 9a02593..a4c2586 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlersPipelining.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlersPipelining.java
@@ -169,7 +169,7 @@ public class TestHttpAsyncHandlersPipelining extends HttpCoreNIOTestBase {
             final List<HttpResponse> responses = future.get();
             Assert.assertNotNull(responses);
             Assert.assertEquals(3, responses.size());
-            for (HttpResponse response: responses) {
+            for (final HttpResponse response: responses) {
                 Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
                 Assert.assertEquals(expectedPattern, EntityUtils.toString(response.getEntity()));
             }
@@ -203,7 +203,7 @@ public class TestHttpAsyncHandlersPipelining extends HttpCoreNIOTestBase {
             final List<HttpResponse> responses = future.get();
             Assert.assertNotNull(responses);
             Assert.assertEquals(3, responses.size());
-            for (HttpResponse response: responses) {
+            for (final HttpResponse response: responses) {
                 Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
             }
         }
@@ -247,7 +247,7 @@ public class TestHttpAsyncHandlersPipelining extends HttpCoreNIOTestBase {
             final List<HttpResponse> responses = future.get();
             Assert.assertNotNull(responses);
             Assert.assertEquals(3, responses.size());
-            for (HttpResponse response: responses) {
+            for (final HttpResponse response: responses) {
                 Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
                 Assert.assertEquals(expectedPattern, EntityUtils.toString(response.getEntity()));
             }
@@ -335,7 +335,7 @@ public class TestHttpAsyncHandlersPipelining extends HttpCoreNIOTestBase {
             final List<HttpResponse> responses = future.get();
             Assert.assertNotNull(responses);
             Assert.assertEquals(3, responses.size());
-            for (HttpResponse response: responses) {
+            for (final HttpResponse response: responses) {
                 Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
             }
             Assert.assertEquals(expectedPattern1, EntityUtils.toString(responses.get(0).getEntity()));
@@ -397,7 +397,7 @@ public class TestHttpAsyncHandlersPipelining extends HttpCoreNIOTestBase {
             final Future<List<HttpResponse>> future = this.client.executePipelined(target, requestProducers, responseConsumers, null, null);
             try {
                 future.get();
-            } catch (ExecutionException ex) {
+            } catch (final ExecutionException ex) {
                 final Throwable cause = ex.getCause();
                 Assert.assertTrue(cause instanceof ConnectionClosedException);
             }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b7cbb794/httpcore-nio/src/test/java/org/apache/http/nio/testserver/HttpClientNio.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/testserver/HttpClientNio.java b/httpcore-nio/src/test/java/org/apache/http/nio/testserver/HttpClientNio.java
index 8a2f13d..3e46a57 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/testserver/HttpClientNio.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/testserver/HttpClientNio.java
@@ -179,7 +179,7 @@ public class HttpClientNio {
                 new ArrayList<HttpAsyncRequestProducer>(requests.size());
         final List<HttpAsyncResponseConsumer<HttpResponse>> responseConsumers =
                 new ArrayList<HttpAsyncResponseConsumer<HttpResponse>>(requests.size());
-        for (HttpRequest request: requests) {
+        for (final HttpRequest request: requests) {
             requestProducers.add(new BasicAsyncRequestProducer(target, request));
             responseConsumers.add(new BasicAsyncResponseConsumer());
         }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b7cbb794/httpcore/src/main/java/org/apache/http/entity/ContentType.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/entity/ContentType.java b/httpcore/src/main/java/org/apache/http/entity/ContentType.java
index 122d17f..4491e56 100644
--- a/httpcore/src/main/java/org/apache/http/entity/ContentType.java
+++ b/httpcore/src/main/java/org/apache/http/entity/ContentType.java
@@ -110,7 +110,7 @@ public final class ContentType implements Serializable {
             TEXT_PLAIN,
             TEXT_XML };
         final HashMap<String, ContentType> map = new HashMap<String, ContentType>();
-        for (ContentType contentType: contentTypes) {
+        for (final ContentType contentType: contentTypes) {
             map.put(contentType.getMimeType(), contentType);
         }
         CONTENT_TYPE_MAP = Collections.unmodifiableMap(map);

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b7cbb794/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java b/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
index 25a6bfc..6e09832 100644
--- a/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
+++ b/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
@@ -229,7 +229,7 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
             public E get() throws InterruptedException, ExecutionException {
                 try {
                     return get(0L, TimeUnit.MILLISECONDS);
-                } catch (TimeoutException ex) {
+                } catch (final TimeoutException ex) {
                     throw new ExecutionException(ex);
                 }
             }
@@ -261,7 +261,7 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
                             }
                             return leasedEntry;
                         }
-                    } catch (IOException ex) {
+                    } catch (final IOException ex) {
                         done.set(true);
                         if (callback != null) {
                             callback.failed(ex);


[43/50] httpcomponents-core git commit: HTTPCORE-463: Fixed incorrect use of connect timeout setting in AbstractNIOConnPool

Posted by ol...@apache.org.
HTTPCORE-463: Fixed incorrect use of connect timeout setting in AbstractNIOConnPool

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1794129 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/f41e162e
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/f41e162e
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/f41e162e

Branch: refs/heads/4.4.x
Commit: f41e162e164703c041071b241dfdcc54df98abe7
Parents: 4d54517
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Sat May 6 09:07:54 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Sat May 6 09:07:54 2017 +0000

----------------------------------------------------------------------
 .../org/apache/http/nio/pool/AbstractNIOConnPool.java  | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/f41e162e/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java b/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
index 77824b4..3025fac 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
@@ -272,8 +272,10 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
         final BasicFuture<E> future = new BasicFuture<E>(callback);
         this.lock.lock();
         try {
-            final long timeout = connectTimeout > 0 ? tunit.toMillis(connectTimeout) : 0;
-            final LeaseRequest<T, C, E> request = new LeaseRequest<T, C, E>(route, state, timeout, leaseTimeout, future);
+            final LeaseRequest<T, C, E> request = new LeaseRequest<T, C, E>(route, state,
+                    connectTimeout >= 0 ? tunit.toMillis(connectTimeout) : -1,
+                    leaseTimeout > 0 ? tunit.toMillis(leaseTimeout) : 0,
+                    future);
             final boolean completed = processPendingRequest(request);
             if (!request.isDone() && !completed) {
                 this.leasingRequests.add(request);
@@ -444,9 +446,10 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
 
             final SessionRequest sessionRequest = this.ioreactor.connect(
                     remoteAddress, localAddress, route, this.sessionRequestCallback);
-            final int timout = request.getConnectTimeout() < Integer.MAX_VALUE ?
-                    (int) request.getConnectTimeout() : Integer.MAX_VALUE;
-            sessionRequest.setConnectTimeout(timout);
+            final long connectTimeout = request.getConnectTimeout();
+            if (connectTimeout >= 0) {
+                sessionRequest.setConnectTimeout(connectTimeout < Integer.MAX_VALUE ? (int) connectTimeout : Integer.MAX_VALUE);
+            }
             this.pending.add(sessionRequest);
             pool.addPending(sessionRequest, request.getFuture());
             return true;


[31/50] httpcomponents-core git commit: Camel-case lvar name.

Posted by ol...@apache.org.
Camel-case lvar name.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1792553 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/1eea0260
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/1eea0260
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/1eea0260

Branch: refs/heads/4.4.x
Commit: 1eea0260241a2854b3aa91ae8c7ac9fb269b699c
Parents: a757585
Author: Gary D. Gregory <gg...@apache.org>
Authored: Mon Apr 24 21:56:33 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Mon Apr 24 21:56:33 2017 +0000

----------------------------------------------------------------------
 .../java/org/apache/http/protocol/RequestTargetHost.java  | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/1eea0260/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java b/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java
index 2c5462a..54e7473 100644
--- a/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java
+++ b/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java
@@ -70,8 +70,8 @@ public class RequestTargetHost implements HttpRequestInterceptor {
         }
 
         if (!request.containsHeader(HTTP.TARGET_HOST)) {
-            HttpHost targethost = coreContext.getTargetHost();
-            if (targethost == null) {
+            HttpHost targetHost = coreContext.getTargetHost();
+            if (targetHost == null) {
                 final HttpConnection conn = coreContext.getConnection();
                 if (conn instanceof HttpInetConnection) {
                     // Populate the context with a default HTTP host based on the
@@ -79,17 +79,17 @@ public class RequestTargetHost implements HttpRequestInterceptor {
                     final InetAddress address = ((HttpInetConnection) conn).getRemoteAddress();
                     final int port = ((HttpInetConnection) conn).getRemotePort();
                     if (address != null) {
-                        targethost = new HttpHost(address.getHostName(), port);
+                        targetHost = new HttpHost(address.getHostName(), port);
                     }
                 }
-                if (targethost == null) {
+                if (targetHost == null) {
                     if (ver.lessEquals(HttpVersion.HTTP_1_0)) {
                         return;
                     }
                     throw new ProtocolException("Target host missing");
                 }
             }
-            request.addHeader(HTTP.TARGET_HOST, targethost.toHostString());
+            request.addHeader(HTTP.TARGET_HOST, targetHost.toHostString());
         }
     }
 


[50/50] httpcomponents-core git commit: Javadoc.

Posted by ol...@apache.org.
Javadoc.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1794494 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/c9810ec1
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/c9810ec1
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/c9810ec1

Branch: refs/heads/4.4.x
Commit: c9810ec117d9643163fc4a174af55287e3b9d8b6
Parents: 8037d7d
Author: Gary D. Gregory <gg...@apache.org>
Authored: Tue May 9 02:56:33 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Tue May 9 02:56:33 2017 +0000

----------------------------------------------------------------------
 .../src/main/java/org/apache/http/ssl/SSLContextBuilder.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/c9810ec1/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
index ff4955f..f736adb 100644
--- a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
+++ b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
@@ -95,10 +95,10 @@ public class SSLContextBuilder {
     }
 
     /**
-     * Sets the SSLContext algorithm name.
+     * Sets the SSLContext protocol algorithm name.
      *
      * @param protocol
-     *            the SSLContext algorithm name of the requested protocol. See
+     *            the SSLContext protocol algorithm name of the requested protocol. See
      *            the SSLContext section in the <a href=
      *            "https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SSLContext">Java
      *            Cryptography Architecture Standard Algorithm Name
@@ -116,10 +116,10 @@ public class SSLContextBuilder {
     }
 
     /**
-     * Sets the SSLContext algorithm name.
+     * Sets the SSLContext protocol algorithm name.
      *
      * @param protocol
-     *            the SSLContext algorithm name of the requested protocol. See
+     *            the SSLContext protocol algorithm name of the requested protocol. See
      *            the SSLContext section in the <a href=
      *            "https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SSLContext">Java
      *            Cryptography Architecture Standard Algorithm Name


[26/50] httpcomponents-core git commit: HTTPCORE-456: BasicFuture fails to honor Future interface contract by not throwing CancellationException when cancelled

Posted by ol...@apache.org.
HTTPCORE-456: BasicFuture fails to honor Future interface contract by not throwing CancellationException when cancelled

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1792447 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/bde8ec2e
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/bde8ec2e
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/bde8ec2e

Branch: refs/heads/4.4.x
Commit: bde8ec2e7b040193cfdea7434a16f23a9930b504
Parents: b9e3688
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Mon Apr 24 10:04:28 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Mon Apr 24 10:04:28 2017 +0000

----------------------------------------------------------------------
 .../org/apache/http/nio/pool/TestNIOConnPool.java    | 15 +++++++++++----
 .../java/org/apache/http/concurrent/BasicFuture.java |  4 ++++
 .../org/apache/http/concurrent/TestBasicFuture.java  | 13 ++++++++-----
 3 files changed, 23 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/bde8ec2e/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java b/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
index 859d547..82abb22 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
@@ -32,6 +32,7 @@ import java.net.InetSocketAddress;
 import java.net.SocketAddress;
 import java.net.UnknownHostException;
 import java.util.Collections;
+import java.util.concurrent.CancellationException;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
@@ -259,8 +260,11 @@ public class TestNIOConnPool {
 
         Assert.assertTrue(future.isDone());
         Assert.assertTrue(future.isCancelled());
-        final LocalPoolEntry entry = future.get();
-        Assert.assertNull(entry);
+        try {
+            future.get();
+            Assert.fail("CancellationException expected");
+        } catch (CancellationException ignore) {
+        }
 
         totals = pool.getTotalStats();
         Assert.assertEquals(0, totals.getAvailable());
@@ -1046,8 +1050,11 @@ public class TestNIOConnPool {
         pool.requestCompleted(sessionRequest1);
 
         Assert.assertTrue(future1.isDone());
-        final LocalPoolEntry entry1 = future1.get();
-        Assert.assertNull(entry1);
+        try {
+            future1.get();
+            Assert.fail("CancellationException expected");
+        } catch (CancellationException ignore) {
+        }
 
         final PoolStats totals = pool.getTotalStats();
         Assert.assertEquals(1, totals.getAvailable());

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/bde8ec2e/httpcore/src/main/java/org/apache/http/concurrent/BasicFuture.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/concurrent/BasicFuture.java b/httpcore/src/main/java/org/apache/http/concurrent/BasicFuture.java
index 4e03cc4..b8b2ca1 100644
--- a/httpcore/src/main/java/org/apache/http/concurrent/BasicFuture.java
+++ b/httpcore/src/main/java/org/apache/http/concurrent/BasicFuture.java
@@ -28,6 +28,7 @@ package org.apache.http.concurrent;
 
 import org.apache.http.util.Args;
 
+import java.util.concurrent.CancellationException;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
@@ -69,6 +70,9 @@ public class BasicFuture<T> implements Future<T>, Cancellable {
         if (this.ex != null) {
             throw new ExecutionException(this.ex);
         }
+        if (cancelled) {
+            throw new CancellationException();
+        }
         return this.result;
     }
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/bde8ec2e/httpcore/src/test/java/org/apache/http/concurrent/TestBasicFuture.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/concurrent/TestBasicFuture.java b/httpcore/src/test/java/org/apache/http/concurrent/TestBasicFuture.java
index 65dfd23..33fc46d 100644
--- a/httpcore/src/test/java/org/apache/http/concurrent/TestBasicFuture.java
+++ b/httpcore/src/test/java/org/apache/http/concurrent/TestBasicFuture.java
@@ -26,6 +26,7 @@
  */
 package org.apache.http.concurrent;
 
+import java.util.concurrent.CancellationException;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
@@ -118,7 +119,11 @@ public class TestBasicFuture {
         Assert.assertNull(callback.getException());
         Assert.assertTrue(callback.isCancelled());
 
-        Assert.assertNull(future.get());
+        try {
+            future.get();
+            Assert.fail("CancellationException expected");
+        } catch (final CancellationException ex) {
+        }
         Assert.assertTrue(future.isDone());
         Assert.assertTrue(future.isCancelled());
     }
@@ -175,7 +180,7 @@ public class TestBasicFuture {
         Assert.assertFalse(future.isCancelled());
     }
 
-    @Test
+    @Test(expected = CancellationException.class)
     public void testAsyncCancelled() throws Exception {
         final BasicFuture<Object> future = new BasicFuture<Object>(null);
 
@@ -193,9 +198,7 @@ public class TestBasicFuture {
         };
         t.setDaemon(true);
         t.start();
-        Assert.assertNull(future.get(60, TimeUnit.SECONDS));
-        Assert.assertTrue(future.isDone());
-        Assert.assertTrue(future.isCancelled());
+        future.get(60, TimeUnit.SECONDS);
     }
 
     @Test(expected=TimeoutException.class)


[36/50] httpcomponents-core git commit: Fix Javadoc typos ("SSl" -> "SSL").

Posted by ol...@apache.org.
Fix Javadoc typos ("SSl" -> "SSL").

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1793845 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/3592c32a
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/3592c32a
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/3592c32a

Branch: refs/heads/4.4.x
Commit: 3592c32a27d9a780dd1039670b1577f774ef797c
Parents: d5a9fbc
Author: Gary D. Gregory <gg...@apache.org>
Authored: Thu May 4 18:39:23 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Thu May 4 18:39:23 2017 +0000

----------------------------------------------------------------------
 .../org/apache/http/impl/nio/reactor/SSLIOSessionHandler.java      | 2 +-
 .../org/apache/http/impl/nio/reactor/SSLSetupHandler.java          | 2 +-
 .../main/java/org/apache/http/nio/reactor/ssl/SSLSetupHandler.java | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/3592c32a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLIOSessionHandler.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLIOSessionHandler.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLIOSessionHandler.java
index 518939b..a0b464a 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLIOSessionHandler.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLIOSessionHandler.java
@@ -37,7 +37,7 @@ import org.apache.http.params.HttpParams;
 
 /**
  * Callback interface that can be used to customize various aspects of
- * the TLS/SSl protocol.
+ * the TLS/SSL protocol.
  *
  * @since 4.0
  *

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/3592c32a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLSetupHandler.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLSetupHandler.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLSetupHandler.java
index d68e4b2..fc867a7 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLSetupHandler.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLSetupHandler.java
@@ -36,7 +36,7 @@ import org.apache.http.params.HttpParams;
 
 /**
  * Callback interface that can be used to customize various aspects of
- * the TLS/SSl protocol.
+ * the TLS/SSL protocol.
  *
  * @since 4.1
  *

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/3592c32a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLSetupHandler.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLSetupHandler.java b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLSetupHandler.java
index 4724fc4..9c81b74 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLSetupHandler.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLSetupHandler.java
@@ -35,7 +35,7 @@ import org.apache.http.nio.reactor.IOSession;
 
 /**
  * Callback interface that can be used to customize various aspects of
- * the TLS/SSl protocol.
+ * the TLS/SSL protocol.
  *
  * @since 4.2
  */


[20/50] httpcomponents-core git commit: HTTPCORE-446: fixed deadlock in AbstractConnPool shutdown code

Posted by ol...@apache.org.
HTTPCORE-446: fixed deadlock in AbstractConnPool shutdown code

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1783929 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/f7b81af5
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/f7b81af5
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/f7b81af5

Branch: refs/heads/4.4.x
Commit: f7b81af572dbd129850825ce240d0685f8664d04
Parents: 217e68e
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Tue Feb 21 20:00:33 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Tue Feb 21 20:00:33 2017 +0000

----------------------------------------------------------------------
 .../org/apache/http/pool/AbstractConnPool.java  | 47 +++++++++++---------
 1 file changed, 25 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/f7b81af5/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java b/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
index d34cf24..25a6bfc 100644
--- a/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
+++ b/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
@@ -38,6 +38,8 @@ import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
@@ -190,37 +192,37 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
 
         return new Future<E>() {
 
-            private volatile boolean cancelled;
-            private volatile boolean done;
-            private volatile E entry;
+            private final AtomicBoolean cancelled = new AtomicBoolean(false);
+            private final AtomicBoolean done = new AtomicBoolean(false);
+            private final AtomicReference<E> entryRef = new AtomicReference<E>(null);
 
             @Override
             public boolean cancel(final boolean mayInterruptIfRunning) {
-                cancelled = true;
-                lock.lock();
-                try {
-                    condition.signalAll();
-                } finally {
-                    lock.unlock();
-                }
-                synchronized (this) {
-                    final boolean result = !done;
-                    done = true;
+                if (cancelled.compareAndSet(false, true)) {
+                    done.set(true);
+                    lock.lock();
+                    try {
+                        condition.signalAll();
+                    } finally {
+                        lock.unlock();
+                    }
                     if (callback != null) {
                         callback.cancelled();
                     }
-                    return result;
+                    return true;
+                } else {
+                    return false;
                 }
             }
 
             @Override
             public boolean isCancelled() {
-                return cancelled;
+                return cancelled.get();
             }
 
             @Override
             public boolean isDone() {
-                return done;
+                return done.get();
             }
 
             @Override
@@ -234,6 +236,7 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
 
             @Override
             public E get(final long timeout, final TimeUnit tunit) throws InterruptedException, ExecutionException, TimeoutException {
+                final E entry = entryRef.get();
                 if (entry != null) {
                     return entry;
                 }
@@ -250,16 +253,16 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
                                     }
                                 }
                             }
-                            entry = leasedEntry;
-                            done = true;
-                            onLease(entry);
+                            entryRef.set(leasedEntry);
+                            done.set(true);
+                            onLease(leasedEntry);
                             if (callback != null) {
-                                callback.completed(entry);
+                                callback.completed(leasedEntry);
                             }
-                            return entry;
+                            return leasedEntry;
                         }
                     } catch (IOException ex) {
-                        done = true;
+                        done.set(true);
                         if (callback != null) {
                             callback.failed(ex);
                         }


[02/50] httpcomponents-core git commit: HTTPCORE-431: correct character encoding default for application/json

Posted by ol...@apache.org.
HTTPCORE-431: correct character encoding default for application/json

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1759344 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/5b2dee7d
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/5b2dee7d
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/5b2dee7d

Branch: refs/heads/4.4.x
Commit: 5b2dee7d4257a488d0dc68f91947093eba43d31a
Parents: 37c5562
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Mon Sep 5 18:55:04 2016 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Mon Sep 5 18:55:04 2016 +0000

----------------------------------------------------------------------
 .../org/apache/http/entity/ContentType.java     | 42 +++++++++-
 .../java/org/apache/http/util/EntityUtils.java  | 85 ++++++++++++--------
 2 files changed, 91 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5b2dee7d/httpcore/src/main/java/org/apache/http/entity/ContentType.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/entity/ContentType.java b/httpcore/src/main/java/org/apache/http/entity/ContentType.java
index 516bfa8..122d17f 100644
--- a/httpcore/src/main/java/org/apache/http/entity/ContentType.java
+++ b/httpcore/src/main/java/org/apache/http/entity/ContentType.java
@@ -31,6 +31,8 @@ import java.io.Serializable;
 import java.nio.charset.Charset;
 import java.nio.charset.UnsupportedCharsetException;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Locale;
@@ -42,8 +44,8 @@ import org.apache.http.HeaderElement;
 import org.apache.http.HttpEntity;
 import org.apache.http.NameValuePair;
 import org.apache.http.ParseException;
-import org.apache.http.annotation.ThreadingBehavior;
 import org.apache.http.annotation.Contract;
+import org.apache.http.annotation.ThreadingBehavior;
 import org.apache.http.message.BasicHeaderValueFormatter;
 import org.apache.http.message.BasicHeaderValueParser;
 import org.apache.http.message.BasicNameValuePair;
@@ -92,6 +94,28 @@ public final class ContentType implements Serializable {
     public static final ContentType WILDCARD = create(
             "*/*", (Charset) null);
 
+
+    private static final Map<String, ContentType> CONTENT_TYPE_MAP;
+    static {
+
+        final ContentType[] contentTypes = {
+            APPLICATION_ATOM_XML,
+            APPLICATION_FORM_URLENCODED,
+            APPLICATION_JSON,
+            APPLICATION_SVG_XML,
+            APPLICATION_XHTML_XML,
+            APPLICATION_XML,
+            MULTIPART_FORM_DATA,
+            TEXT_HTML,
+            TEXT_PLAIN,
+            TEXT_XML };
+        final HashMap<String, ContentType> map = new HashMap<String, ContentType>();
+        for (ContentType contentType: contentTypes) {
+            map.put(contentType.getMimeType(), contentType);
+        }
+        CONTENT_TYPE_MAP = Collections.unmodifiableMap(map);
+    }
+
     // defaults
     public static final ContentType DEFAULT_TEXT = TEXT_PLAIN;
     public static final ContentType DEFAULT_BINARY = APPLICATION_OCTET_STREAM;
@@ -362,6 +386,22 @@ public final class ContentType implements Serializable {
         return contentType != null ? contentType : DEFAULT_TEXT;
     }
 
+
+    /**
+     * Returns {@code Content-Type} for the given MIME type.
+     *
+     * @param mimeType MIME type
+     * @return content type or {@code null} if not known.
+     *
+     * @since 4.5
+     */
+    public static ContentType getByMimeType(final String mimeType) {
+        if (mimeType == null) {
+            return null;
+        }
+        return CONTENT_TYPE_MAP.get(mimeType);
+    }
+
     /**
      * Creates a new instance with this MIME type and the given Charset.
      *

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5b2dee7d/httpcore/src/main/java/org/apache/http/util/EntityUtils.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/util/EntityUtils.java b/httpcore/src/main/java/org/apache/http/util/EntityUtils.java
index c58625c..83297f0 100644
--- a/httpcore/src/main/java/org/apache/http/util/EntityUtils.java
+++ b/httpcore/src/main/java/org/apache/http/util/EntityUtils.java
@@ -193,25 +193,9 @@ public final class EntityUtils {
         return mimeType;
     }
 
-    /**
-     * Get the entity content as a String, using the provided default character set
-     * if none is found in the entity.
-     * If defaultCharset is null, the default "ISO-8859-1" is used.
-     *
-     * @param entity must not be null
-     * @param defaultCharset character set to be applied if none found in the entity,
-     * or if the entity provided charset is invalid or not available.
-     * @return the entity content as a String. May be null if
-     *   {@link HttpEntity#getContent()} is null.
-     * @throws ParseException if header elements cannot be parsed
-     * @throws IllegalArgumentException if entity is null or if content length &gt; Integer.MAX_VALUE
-     * @throws IOException if an error occurs reading the input stream
-     * @throws UnsupportedCharsetException Thrown when the named entity's charset is not available in
-     * this instance of the Java virtual machine and no defaultCharset is provided.
-     */
-    public static String toString(
-            final HttpEntity entity, final Charset defaultCharset) throws IOException, ParseException {
-        Args.notNull(entity, "Entity");
+    private static String toString(
+            final HttpEntity entity,
+            final ContentType contentType) throws IOException {
         final InputStream instream = entity.getContent();
         if (instream == null) {
             return null;
@@ -224,18 +208,12 @@ public final class EntityUtils {
                 i = 4096;
             }
             Charset charset = null;
-            try {
-                final ContentType contentType = ContentType.get(entity);
-                if (contentType != null) {
-                    charset = contentType.getCharset();
+            if (contentType != null) {
+                charset = contentType.getCharset();
+                if (charset == null) {
+                    final ContentType defaultContentType = ContentType.getByMimeType(contentType.getMimeType());
+                    charset = defaultContentType != null ? defaultContentType.getCharset() : null;
                 }
-            } catch (final UnsupportedCharsetException ex) {
-                if (defaultCharset == null) {
-                    throw new UnsupportedEncodingException(ex.getMessage());
-                }
-            }
-            if (charset == null) {
-                charset = defaultCharset;
             }
             if (charset == null) {
                 charset = HTTP.DEF_CONTENT_CHARSET;
@@ -259,13 +237,50 @@ public final class EntityUtils {
      * If defaultCharset is null, the default "ISO-8859-1" is used.
      *
      * @param entity must not be null
+     * @param defaultCharset character set to be applied if none found in the entity,
+     * or if the entity provided charset is invalid or not available.
+     * @return the entity content as a String. May be null if
+     *   {@link HttpEntity#getContent()} is null.
+     * @throws ParseException if header elements cannot be parsed
+     * @throws IllegalArgumentException if entity is null or if content length &gt; Integer.MAX_VALUE
+     * @throws IOException if an error occurs reading the input stream
+     * @throws java.nio.charset.UnsupportedCharsetException Thrown when the named entity's charset is not available in
+     * this instance of the Java virtual machine and no defaultCharset is provided.
+     */
+    public static String toString(
+            final HttpEntity entity, final Charset defaultCharset) throws IOException, ParseException {
+        Args.notNull(entity, "Entity");
+        ContentType contentType = null;
+        try {
+            contentType = ContentType.get(entity);
+        } catch (final UnsupportedCharsetException ex) {
+            if (defaultCharset == null) {
+                throw new UnsupportedEncodingException(ex.getMessage());
+            }
+        }
+        if (contentType != null) {
+            if (contentType.getCharset() == null) {
+                contentType = contentType.withCharset(defaultCharset);
+            }
+        } else {
+            contentType = ContentType.DEFAULT_TEXT.withCharset(defaultCharset);
+        }
+        return toString(entity, contentType);
+    }
+
+    /**
+     * Get the entity content as a String, using the provided default character set
+     * if none is found in the entity.
+     * If defaultCharset is null, the default "ISO-8859-1" is used.
+     *
+     * @param entity must not be null
      * @param defaultCharset character set to be applied if none found in the entity
      * @return the entity content as a String. May be null if
      *   {@link HttpEntity#getContent()} is null.
      * @throws ParseException if header elements cannot be parsed
      * @throws IllegalArgumentException if entity is null or if content length &gt; Integer.MAX_VALUE
      * @throws IOException if an error occurs reading the input stream
-     * @throws UnsupportedCharsetException Thrown when the named charset is not available in
+     * @throws java.nio.charset.UnsupportedCharsetException Thrown when the named charset is not available in
      * this instance of the Java virtual machine
      */
     public static String toString(
@@ -283,12 +298,12 @@ public final class EntityUtils {
      * @throws ParseException if header elements cannot be parsed
      * @throws IllegalArgumentException if entity is null or if content length &gt; Integer.MAX_VALUE
      * @throws IOException if an error occurs reading the input stream
-     * @throws UnsupportedCharsetException Thrown when the named charset is not available in
+     * @throws java.nio.charset.UnsupportedCharsetException Thrown when the named charset is not available in
      * this instance of the Java virtual machine
      */
-    public static String toString(final HttpEntity entity)
-        throws IOException, ParseException {
-        return toString(entity, (Charset)null);
+    public static String toString(final HttpEntity entity) throws IOException, ParseException {
+        Args.notNull(entity, "Entity");
+        return toString(entity, ContentType.get(entity));
     }
 
 }


[11/50] httpcomponents-core git commit: Add Travis CI.

Posted by ol...@apache.org.
Add Travis CI.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1772787 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/5946938d
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/5946938d
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/5946938d

Branch: refs/heads/4.4.x
Commit: 5946938d8d8c7a4d85cd23ef612e400d53b0e45f
Parents: f2452db
Author: Gary D. Gregory <gg...@apache.org>
Authored: Mon Dec 5 20:22:41 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Mon Dec 5 20:22:41 2016 +0000

----------------------------------------------------------------------
 .travis.yml | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5946938d/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..cafe93d
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,25 @@
+# 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.
+
+language: java
+sudo: false
+
+jdk:
+  - openjdk7
+  - oraclejdk7
+  - oraclejdk8
+
+after_success:
+  - mvn clean cobertura:cobertura coveralls:report


[44/50] httpcomponents-core git commit: Add toString() method. Local build OK.

Posted by ol...@apache.org.
Add toString() method. Local build OK.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1794174 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/a7f903c1
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/a7f903c1
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/a7f903c1

Branch: refs/heads/4.4.x
Commit: a7f903c1ed6cf8f54d45e6d47f07a499f5ea9db5
Parents: f41e162
Author: Gary D. Gregory <gg...@apache.org>
Authored: Sat May 6 19:18:09 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Sat May 6 19:18:09 2017 +0000

----------------------------------------------------------------------
 .../java/org/apache/http/impl/nio/SessionHttpContext.java   | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/a7f903c1/httpcore-nio/src/main/java/org/apache/http/impl/nio/SessionHttpContext.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SessionHttpContext.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SessionHttpContext.java
index d597338..c6aa3e6 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SessionHttpContext.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SessionHttpContext.java
@@ -54,4 +54,13 @@ class SessionHttpContext implements HttpContext {
         this.iosession.setAttribute(id, obj);
     }
 
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder();
+        sb.append("[iosession=");
+        sb.append(iosession);
+        sb.append("]");
+        return sb.toString();
+    }
+
 }


[46/50] httpcomponents-core git commit: [HTTPCORE-464] org.apache.http.nio.protocol.HttpAsyncService does not always log exceptions.

Posted by ol...@apache.org.
[HTTPCORE-464] org.apache.http.nio.protocol.HttpAsyncService does not always log exceptions.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1794222 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/6a5189ba
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/6a5189ba
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/6a5189ba

Branch: refs/heads/4.4.x
Commit: 6a5189bada8d9b35aac944d0baec646ff23b5ba7
Parents: 04721b9
Author: Gary D. Gregory <gg...@apache.org>
Authored: Sun May 7 16:45:59 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Sun May 7 16:45:59 2017 +0000

----------------------------------------------------------------------
 RELEASE_NOTES.txt                                                 | 3 +++
 .../main/java/org/apache/http/nio/protocol/HttpAsyncService.java  | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/6a5189ba/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index b29e546..21409ad 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -18,6 +18,9 @@ Changelog
 * HTTPCORE-462: Deprecate SSLContextBuilder.useProtocol(String) in favor a new method setProtocol(String).
   Contributed by Gary Gregory <ggregory at apache.org>
 
+* HTTPCORE-464: org.apache.http.nio.protocol.HttpAsyncService does not always log exceptions.
+  Contributed by Gary Gregory <ggregory at apache.org>
+
 
 Release 4.4.6
 -------------------

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/6a5189ba/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
index d8a783d..f941399 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
@@ -277,10 +277,10 @@ public class HttpAsyncService implements NHttpServerEventHandler {
     @Override
     public void exception(
             final NHttpServerConnection conn, final Exception cause) {
+        log(cause);
         final State state = getState(conn);
         if (state == null) {
             shutdownConnection(conn);
-            log(cause);
             return;
         }
         state.setTerminated();


[42/50] httpcomponents-core git commit: Format tweak.

Posted by ol...@apache.org.
Format tweak.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1794116 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/4d545174
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/4d545174
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/4d545174

Branch: refs/heads/4.4.x
Commit: 4d545174f596ba58a1bcdded955ad700873ee261
Parents: 6b592d5
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri May 5 23:35:18 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri May 5 23:35:18 2017 +0000

----------------------------------------------------------------------
 .../src/main/java/org/apache/http/nio/reactor/ssl/SSLBuffer.java | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/4d545174/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLBuffer.java b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLBuffer.java
index 6ce8653..fd75694 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLBuffer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLBuffer.java
@@ -32,6 +32,7 @@ import java.nio.ByteBuffer;
  * Managed internal SSL buffer.
  */
 public interface SSLBuffer {
+
     /**
      * Allocates the resources required for this buffer, or returns the resources already allocated for this buffer.
      * Unless {@link #release() } is called, multiple invokations to this method must return the same
@@ -39,15 +40,18 @@ public interface SSLBuffer {
      * @return buffer
      */
     ByteBuffer acquire();
+
     /**
      * Releases the resources for this buffer. If the buffer has already been released, this method does nothing.
      */
     void release();
+
     /**
      * Tests to see if this buffer has been acquired.
      * @return {@code true} if the buffer is acquired, otherwise {@code false}
      */
     boolean isAcquired();
+
     /**
      * Tests to make sure that the buffer has been acquired and the underlying buffer has a position larger than
      * {@code 0}. Essentially the same as {@code isAquired() && acquire().position > 0}.


[12/50] httpcomponents-core git commit: Updated release notes for HttpCore 4.4.6 release

Posted by ol...@apache.org.
Updated release notes for HttpCore 4.4.6 release

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1777784 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/8f6de471
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/8f6de471
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/8f6de471

Branch: refs/heads/4.4.x
Commit: 8f6de471a977cf722e487bdb04c896209f85979c
Parents: 5946938
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Sat Jan 7 13:22:30 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Sat Jan 7 13:22:30 2017 +0000

----------------------------------------------------------------------
 RELEASE_NOTES.txt | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/8f6de471/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 21e46ca..d4e9264 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,3 +1,41 @@
+Release 4.4.6
+-------------------
+
+This is a maintenance release that fixes a number of issues discovered since 4.4.5.
+
+Changelog
+-------------------
+
+* [HTTPCORE-429] NIO connection pool incorrectly reports the number of pending connections
+  per individual route.
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
+* [HTTPCORE-433] moved expensive connection validation code outside the pool lock.
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
+* [HTTPCORE-435] ConnectionConfig#copy() does not copy every field.
+  Contributed by Clement Pellerin <clement_pellerin at ibi.com>
+
+* [HTTPCORE-434] Handling of HEAD responses without payload headers.
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
+* [HTTPCORE-431] correct character encoding default for application/json.
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
+* [HTTPCORE-428] SSLIOSession#close to handle CancelledKeyException.
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
+* [HTTPCORE-427] SSL i/o sessions to use a finite timeout for SSL shutdown handshake when closing.
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
+* [HTTPCORE-422] HttpAsyncResponseConsumer#onEntityEnclosed is triggered for HEAD responses.
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
+* [HTTPCORE-423] Fixed MIME type validation in ContentType#create(String) method.
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
+
+
 Release 4.4.5
 -------------------
 


[03/50] httpcomponents-core git commit: HTTPCORE-434: Handling of HEAD responses without payload headers

Posted by ol...@apache.org.
HTTPCORE-434: Handling of HEAD responses without payload headers

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1763889 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/441c9c46
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/441c9c46
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/441c9c46

Branch: refs/heads/4.4.x
Commit: 441c9c46f6f2c8fb1c54c7c9233f578a4e4056a5
Parents: 5b2dee7
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Sat Oct 8 11:11:09 2016 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Sat Oct 8 11:11:09 2016 +0000

----------------------------------------------------------------------
 .../impl/DefaultConnectionReuseStrategy.java    | 42 +++++++++++++++-----
 .../TestDefaultConnectionReuseStrategy.java     | 24 +++++++++++
 2 files changed, 55 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/441c9c46/httpcore/src/main/java/org/apache/http/impl/DefaultConnectionReuseStrategy.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/DefaultConnectionReuseStrategy.java b/httpcore/src/main/java/org/apache/http/impl/DefaultConnectionReuseStrategy.java
index 8f73a6e..7a81d45 100644
--- a/httpcore/src/main/java/org/apache/http/impl/DefaultConnectionReuseStrategy.java
+++ b/httpcore/src/main/java/org/apache/http/impl/DefaultConnectionReuseStrategy.java
@@ -30,18 +30,20 @@ package org.apache.http.impl;
 import org.apache.http.ConnectionReuseStrategy;
 import org.apache.http.Header;
 import org.apache.http.HeaderIterator;
+import org.apache.http.HttpHeaders;
+import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpStatus;
 import org.apache.http.HttpVersion;
 import org.apache.http.ParseException;
 import org.apache.http.ProtocolVersion;
 import org.apache.http.TokenIterator;
-import org.apache.http.annotation.ThreadingBehavior;
 import org.apache.http.annotation.Contract;
-import org.apache.http.message.BasicHeaderIterator;
+import org.apache.http.annotation.ThreadingBehavior;
 import org.apache.http.message.BasicTokenIterator;
 import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
+import org.apache.http.protocol.HttpCoreContext;
 import org.apache.http.util.Args;
 
 /**
@@ -78,6 +80,22 @@ public class DefaultConnectionReuseStrategy implements ConnectionReuseStrategy {
         Args.notNull(response, "HTTP response");
         Args.notNull(context, "HTTP context");
 
+        final HttpRequest request = (HttpRequest) context.getAttribute(HttpCoreContext.HTTP_REQUEST);
+        if (request != null) {
+            try {
+                final TokenIterator ti = new BasicTokenIterator(request.headerIterator(HttpHeaders.CONNECTION));
+                while (ti.hasNext()) {
+                    final String token = ti.nextToken();
+                    if (HTTP.CONN_CLOSE.equalsIgnoreCase(token)) {
+                        return false;
+                    }
+                }
+            } catch (final ParseException px) {
+                // invalid connection header. do not re-use
+                return false;
+            }
+        }
+
         // Check for a self-terminating entity. If the end of the entity will
         // be indicated by closing the connection, there is no keep-alive.
         final ProtocolVersion ver = response.getStatusLine().getProtocolVersion();
@@ -87,7 +105,7 @@ public class DefaultConnectionReuseStrategy implements ConnectionReuseStrategy {
                 return false;
             }
         } else {
-            if (canResponseHaveBody(response)) {
+            if (canResponseHaveBody(request, response)) {
                 final Header[] clhs = response.getHeaders(HTTP.CONTENT_LEN);
                 // Do not reuse if not properly content-length delimited
                 if (clhs.length == 1) {
@@ -109,9 +127,9 @@ public class DefaultConnectionReuseStrategy implements ConnectionReuseStrategy {
         // Check for the "Connection" header. If that is absent, check for
         // the "Proxy-Connection" header. The latter is an unspecified and
         // broken but unfortunately common extension of HTTP.
-        Header[] connHeaders = response.getHeaders(HTTP.CONN_DIRECTIVE);
-        if (connHeaders.length == 0) {
-            connHeaders = response.getHeaders("Proxy-Connection");
+        HeaderIterator headerIterator = response.headerIterator(HTTP.CONN_DIRECTIVE);
+        if (!headerIterator.hasNext()) {
+            headerIterator = response.headerIterator("Proxy-Connection");
         }
 
         // Experimental usage of the "Connection" header in HTTP/1.0 is
@@ -137,9 +155,9 @@ public class DefaultConnectionReuseStrategy implements ConnectionReuseStrategy {
         // it takes precedence and indicates a non-persistent connection.
         // If there is no "close" but a "keep-alive", we take the hint.
 
-        if (connHeaders.length != 0) {
+        if (headerIterator.hasNext()) {
             try {
-                final TokenIterator ti = new BasicTokenIterator(new BasicHeaderIterator(connHeaders, null));
+                final TokenIterator ti = new BasicTokenIterator(headerIterator);
                 boolean keepalive = false;
                 while (ti.hasNext()) {
                     final String token = ti.nextToken();
@@ -156,8 +174,7 @@ public class DefaultConnectionReuseStrategy implements ConnectionReuseStrategy {
                 }
 
             } catch (final ParseException px) {
-                // invalid connection header means no persistent connection
-                // we don't have logging in HttpCore, so the exception is lost
+                // invalid connection header. do not re-use
                 return false;
             }
         }
@@ -180,7 +197,10 @@ public class DefaultConnectionReuseStrategy implements ConnectionReuseStrategy {
         return new BasicTokenIterator(hit);
     }
 
-    private boolean canResponseHaveBody(final HttpResponse response) {
+    private boolean canResponseHaveBody(final HttpRequest request, final HttpResponse response) {
+        if (request != null && request.getRequestLine().getMethod().equalsIgnoreCase("HEAD")) {
+            return false;
+        }
         final int status = response.getStatusLine().getStatusCode();
         return status >= HttpStatus.SC_OK
             && status != HttpStatus.SC_NO_CONTENT

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/441c9c46/httpcore/src/test/java/org/apache/http/impl/TestDefaultConnectionReuseStrategy.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/impl/TestDefaultConnectionReuseStrategy.java b/httpcore/src/test/java/org/apache/http/impl/TestDefaultConnectionReuseStrategy.java
index aad37ab..44f89ce 100644
--- a/httpcore/src/test/java/org/apache/http/impl/TestDefaultConnectionReuseStrategy.java
+++ b/httpcore/src/test/java/org/apache/http/impl/TestDefaultConnectionReuseStrategy.java
@@ -28,12 +28,15 @@
 package org.apache.http.impl;
 
 import org.apache.http.ConnectionReuseStrategy;
+import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpStatus;
 import org.apache.http.HttpVersion;
+import org.apache.http.message.BasicHttpRequest;
 import org.apache.http.message.BasicHttpResponse;
 import org.apache.http.protocol.BasicHttpContext;
 import org.apache.http.protocol.HttpContext;
+import org.apache.http.protocol.HttpCoreContext;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -260,5 +263,26 @@ public class TestDefaultConnectionReuseStrategy {
         Assert.assertFalse(reuseStrategy.keepAlive(response, context));
     }
 
+    @Test
+    public void testRequestClose() throws Exception {
+        final HttpRequest request = new BasicHttpRequest("GET", "/");
+        request.addHeader("Connection", "close");
+        context.setAttribute(HttpCoreContext.HTTP_REQUEST, request);
+        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        response.addHeader("Content-Length", "10");
+        response.addHeader("Connection", "keep-alive");
+
+        Assert.assertFalse(reuseStrategy.keepAlive(response, context));
+    }
+
+    @Test
+    public void testHeadRequestWithout() throws Exception {
+        final HttpRequest request = new BasicHttpRequest("HEAD", "/");
+        context.setAttribute(HttpCoreContext.HTTP_REQUEST, request);
+        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+
+        Assert.assertTrue(reuseStrategy.keepAlive(response, context));
+    }
+
 }
 


[37/50] httpcomponents-core git commit: [HTTPCORE-450] Add a Provider parameter in SSLContextBuilder. Add SSLContextBuilder.setProvider(String).

Posted by ol...@apache.org.
[HTTPCORE-450] Add a Provider parameter in SSLContextBuilder. Add SSLContextBuilder.setProvider(String).

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1793914 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/c5295f7e
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/c5295f7e
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/c5295f7e

Branch: refs/heads/4.4.x
Commit: c5295f7e14a52abd331d092791e5d7c0fb74446e
Parents: 3592c32
Author: Gary D. Gregory <gg...@apache.org>
Authored: Thu May 4 22:30:05 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Thu May 4 22:30:05 2017 +0000

----------------------------------------------------------------------
 .../java/org/apache/http/ssl/SSLContextBuilder.java     |  6 ++++++
 .../java/org/apache/http/ssl/TestSSLContextBuilder.java | 12 ++++++++++++
 2 files changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/c5295f7e/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
index 87c5470..70ed1f4 100644
--- a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
+++ b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
@@ -41,6 +41,7 @@ import java.security.Principal;
 import java.security.PrivateKey;
 import java.security.Provider;
 import java.security.SecureRandom;
+import java.security.Security;
 import java.security.UnrecoverableKeyException;
 import java.security.cert.CertificateException;
 import java.security.cert.X509Certificate;
@@ -122,6 +123,11 @@ public class SSLContextBuilder {
         return this;
     }
 
+    public SSLContextBuilder setProvider(final String name) {
+        this.provider = Security.getProvider(name);
+        return this;
+    }
+
     public SSLContextBuilder loadTrustMaterial(
             final KeyStore truststore,
             final TrustStrategy trustStrategy) throws NoSuchAlgorithmException, KeyStoreException {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/c5295f7e/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java b/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
index ae132f0..b789fcf 100644
--- a/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
+++ b/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
@@ -631,4 +631,16 @@ public class TestSSLContextBuilder {
         Assert.assertTrue(sslContext.getProvider().getName().equals("SunJSSE"));
     }
 
+    @Test
+    public void testBuildWithProviderName() throws Exception {
+        final URL resource1 = getClass().getResource("/test-server.keystore");
+        final String storePassword = "nopassword";
+        final String keyPassword = "nopassword";
+        final SSLContext sslContext=SSLContextBuilder.create()
+                .setProvider("SunJSSE")
+                .loadKeyMaterial(resource1, storePassword.toCharArray(), keyPassword.toCharArray())
+                .build();
+        Assert.assertTrue(sslContext.getProvider().getName().equals("SunJSSE"));
+    }
+
 }


[33/50] httpcomponents-core git commit: Fix parmeter names.

Posted by ol...@apache.org.
Fix parmeter names.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1793755 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/89892b8e
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/89892b8e
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/89892b8e

Branch: refs/heads/4.4.x
Commit: 89892b8e27fcc32a29f672af6c1ec65d2350be99
Parents: 751f349
Author: Gary D. Gregory <gg...@apache.org>
Authored: Thu May 4 08:54:07 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Thu May 4 08:54:07 2017 +0000

----------------------------------------------------------------------
 .../org/apache/http/nio/reactor/ssl/SSLSetupHandler.java  | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/89892b8e/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLSetupHandler.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLSetupHandler.java b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLSetupHandler.java
index e2afbd8..4724fc4 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLSetupHandler.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLSetupHandler.java
@@ -46,11 +46,11 @@ public interface SSLSetupHandler {
      * can use this callback to customize properties of the {@link SSLEngine}
      * used to establish the SSL session.
      *
-     * @param sslengine the SSL engine.
+     * @param sslEngine the SSL engine.
      * @throws SSLException if case of SSL protocol error.
      */
     //FIXME: fix type
-    void initalize(SSLEngine sslengine) throws SSLException;
+    void initalize(SSLEngine sslEngine) throws SSLException;
 
     /**
      * Triggered when the SSL connection has been established and initial SSL
@@ -59,10 +59,10 @@ public interface SSLSetupHandler {
      * For instance this would be the right place to enforce SSL cipher
      * strength, validate certificate chain and do hostname checks.
      *
-     * @param iosession the underlying IOSession for the SSL connection.
-     * @param sslsession newly created SSL session.
+     * @param ioSession the underlying IOSession for the SSL connection.
+     * @param sslSession newly created SSL session.
      * @throws SSLException if case of SSL protocol error.
      */
-    void verify(IOSession iosession, SSLSession sslsession) throws SSLException;
+    void verify(IOSession ioSession, SSLSession sslSession) throws SSLException;
 
 }


[13/50] httpcomponents-core git commit: Updated NOTICE

Posted by ol...@apache.org.
Updated NOTICE

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1777787 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/69339331
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/69339331
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/69339331

Branch: refs/heads/4.4.x
Commit: 6933933167fe304f073ccf2616a1f55a0f1c870b
Parents: 8f6de47
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Sat Jan 7 13:35:58 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Sat Jan 7 13:35:58 2017 +0000

----------------------------------------------------------------------
 NOTICE.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/69339331/NOTICE.txt
----------------------------------------------------------------------
diff --git a/NOTICE.txt b/NOTICE.txt
index 013448d..40ba6b7 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -1,5 +1,5 @@
 Apache HttpComponents Core
-Copyright 2005-2016 The Apache Software Foundation
+Copyright 2005-2017 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).


[29/50] httpcomponents-core git commit: Camel-case lvar name.

Posted by ol...@apache.org.
Camel-case lvar name.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1792550 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/03a8746b
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/03a8746b
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/03a8746b

Branch: refs/heads/4.4.x
Commit: 03a8746b81f25d900dec1f0f6576d9a28a0780b0
Parents: a66c14d
Author: Gary D. Gregory <gg...@apache.org>
Authored: Mon Apr 24 21:39:36 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Mon Apr 24 21:39:36 2017 +0000

----------------------------------------------------------------------
 .../main/java/org/apache/http/protocol/RequestTargetHost.java  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/03a8746b/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java b/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java
index 8221786..53f4051 100644
--- a/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java
+++ b/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java
@@ -61,7 +61,7 @@ public class RequestTargetHost implements HttpRequestInterceptor {
             throws HttpException, IOException {
         Args.notNull(request, "HTTP request");
 
-        final HttpCoreContext corecontext = HttpCoreContext.adapt(context);
+        final HttpCoreContext coreContext = HttpCoreContext.adapt(context);
 
         final ProtocolVersion ver = request.getRequestLine().getProtocolVersion();
         final String method = request.getRequestLine().getMethod();
@@ -70,9 +70,9 @@ public class RequestTargetHost implements HttpRequestInterceptor {
         }
 
         if (!request.containsHeader(HTTP.TARGET_HOST)) {
-            HttpHost targethost = corecontext.getTargetHost();
+            HttpHost targethost = coreContext.getTargetHost();
             if (targethost == null) {
-                final HttpConnection conn = corecontext.getConnection();
+                final HttpConnection conn = coreContext.getConnection();
                 if (conn instanceof HttpInetConnection) {
                     // Populate the context with a default HTTP host based on the
                     // inet address of the target host


[25/50] httpcomponents-core git commit: Javadoc.

Posted by ol...@apache.org.
Javadoc.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1790467 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/b9e36884
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/b9e36884
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/b9e36884

Branch: refs/heads/4.4.x
Commit: b9e36884f876dbe7052742e5955ec50b6d1021d6
Parents: d2ac506
Author: Gary D. Gregory <gg...@apache.org>
Authored: Thu Apr 6 20:59:58 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Thu Apr 6 20:59:58 2017 +0000

----------------------------------------------------------------------
 httpcore/src/main/java/org/apache/http/HttpStatus.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b9e36884/httpcore/src/main/java/org/apache/http/HttpStatus.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/HttpStatus.java b/httpcore/src/main/java/org/apache/http/HttpStatus.java
index 863e383..6893e09 100644
--- a/httpcore/src/main/java/org/apache/http/HttpStatus.java
+++ b/httpcore/src/main/java/org/apache/http/HttpStatus.java
@@ -33,7 +33,9 @@ package org.apache.http;
  * RFC2518 (WebDAV) are listed.
  *
  * @see StatusLine
- *
+ * @see <a href="https://tools.ietf.org/html/rfc1945">RFC1945 (HTTP/1.0)</a>
+ * @see <a href="https://tools.ietf.org/html/rfc2616">RFC2616 (HTTP/1.1)</a>
+ * @see <a href="https://tools.ietf.org/html/rfc2518">RFC2518 (WebDAV)</a>
  * @since 4.0
  */
 public interface HttpStatus {


[28/50] httpcomponents-core git commit: Javaodc: Remove extra blank line.

Posted by ol...@apache.org.
Javaodc: Remove extra blank line.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1792542 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/a66c14d6
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/a66c14d6
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/a66c14d6

Branch: refs/heads/4.4.x
Commit: a66c14d6708ba251e2a099caeaf4411872397ed2
Parents: efb11b8
Author: Gary D. Gregory <gg...@apache.org>
Authored: Mon Apr 24 20:06:10 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Mon Apr 24 20:06:10 2017 +0000

----------------------------------------------------------------------
 httpcore/src/main/java/org/apache/http/HttpHost.java | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/a66c14d6/httpcore/src/main/java/org/apache/http/HttpHost.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/HttpHost.java b/httpcore/src/main/java/org/apache/http/HttpHost.java
index 528efcc..cbd5ac0 100644
--- a/httpcore/src/main/java/org/apache/http/HttpHost.java
+++ b/httpcore/src/main/java/org/apache/http/HttpHost.java
@@ -40,7 +40,6 @@ import org.apache.http.util.LangUtils;
  * Holds all of the variables needed to describe an HTTP connection to a host.
  * This includes remote host name, port and scheme.
  *
- *
  * @since 4.0
  */
 @Contract(threading = ThreadingBehavior.IMMUTABLE)


[35/50] httpcomponents-core git commit: Rename variables "sslcontext" to "sslContext".

Posted by ol...@apache.org.
Rename variables "sslcontext" to "sslContext".

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1793838 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/d5a9fbc8
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/d5a9fbc8
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/d5a9fbc8

Branch: refs/heads/4.4.x
Commit: d5a9fbc8d2da8af88eb01e542883d512c8903788
Parents: 2b8fb85
Author: Gary D. Gregory <gg...@apache.org>
Authored: Thu May 4 17:44:37 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Thu May 4 17:44:37 2017 +0000

----------------------------------------------------------------------
 .../http/examples/nio/NHttpFileServer.java      |  6 ++--
 .../http/impl/nio/SSLClientIOEventDispatch.java | 24 +++++++--------
 .../http/impl/nio/SSLServerIOEventDispatch.java | 24 +++++++--------
 .../impl/nio/ssl/SSLClientIOEventDispatch.java  | 24 +++++++--------
 .../impl/nio/ssl/SSLServerIOEventDispatch.java  | 24 +++++++--------
 .../impl/nio/DefaultHttpClientIODispatch.java   | 16 +++++-----
 .../impl/nio/DefaultHttpServerIODispatch.java   | 16 +++++-----
 .../apache/http/impl/nio/SSLContextUtils.java   | 10 +++---
 .../nio/SSLNHttpClientConnectionFactory.java    | 32 ++++++++++----------
 .../nio/SSLNHttpServerConnectionFactory.java    | 32 ++++++++++----------
 .../http/impl/nio/pool/BasicNIOConnFactory.java | 16 +++++-----
 .../http/nio/reactor/ssl/SSLIOSession.java      |  6 ++--
 .../nio/testserver/ClientConnectionFactory.java | 14 ++++-----
 .../nio/testserver/ServerConnectionFactory.java | 14 ++++-----
 .../apache/http/examples/HttpFileServer.java    |  6 ++--
 .../org/apache/http/ssl/SSLContextBuilder.java  | 16 +++++-----
 .../java/org/apache/http/ssl/SSLContexts.java   |  6 ++--
 17 files changed, 143 insertions(+), 143 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d5a9fbc8/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java b/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
index c8bb1a2..612c02e 100644
--- a/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
+++ b/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
@@ -75,7 +75,7 @@ public class NHttpFileServer {
             port = Integer.parseInt(args[1]);
         }
 
-        SSLContext sslcontext = null;
+        SSLContext sslContext = null;
         if (port == 8443) {
             // Initialize SSL context
             URL url = NHttpFileServer.class.getResource("/my.keystore");
@@ -83,7 +83,7 @@ public class NHttpFileServer {
                 System.out.println("Keystore not found");
                 System.exit(1);
             }
-            sslcontext = SSLContexts.custom()
+            sslContext = SSLContexts.custom()
                     .loadKeyMaterial(url, "secret".toCharArray(), "secret".toCharArray())
                     .build();
         }
@@ -97,7 +97,7 @@ public class NHttpFileServer {
                 .setListenerPort(port)
                 .setServerInfo("Test/1.1")
                 .setIOReactorConfig(config)
-                .setSslContext(sslcontext)
+                .setSslContext(sslContext)
                 .setExceptionLogger(ExceptionLogger.STD_ERR)
                 .registerHandler("*", new HttpFileHandler(docRoot))
                 .create();

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d5a9fbc8/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLClientIOEventDispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLClientIOEventDispatch.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLClientIOEventDispatch.java
index 741b374..b43bbb8 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLClientIOEventDispatch.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLClientIOEventDispatch.java
@@ -61,7 +61,7 @@ public class SSLClientIOEventDispatch implements IOEventDispatch {
     private static final String SSL_SESSION = "SSL_SESSION";
 
     protected final NHttpClientHandler handler;
-    protected final SSLContext sslcontext;
+    protected final SSLContext sslContext;
     protected final SSLIOSessionHandler sslHandler;
     protected final HttpParams params;
 
@@ -72,22 +72,22 @@ public class SSLClientIOEventDispatch implements IOEventDispatch {
      * protocol aspects for HTTP connections.
      *
      * @param handler the client protocol handler.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param sslHandler the SSL handler.
      * @param params HTTP parameters.
      */
     public SSLClientIOEventDispatch(
             final NHttpClientHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLIOSessionHandler sslHandler,
             final HttpParams params) {
         super();
         Args.notNull(handler, "HTTP client handler");
-        Args.notNull(sslcontext, "SSL context");
+        Args.notNull(sslContext, "SSL context");
         Args.notNull(params, "HTTP parameters");
         this.handler = handler;
         this.params = params;
-        this.sslcontext = sslcontext;
+        this.sslContext = sslContext;
         this.sslHandler = sslHandler;
     }
 
@@ -98,14 +98,14 @@ public class SSLClientIOEventDispatch implements IOEventDispatch {
      * protocol aspects for HTTP connections.
      *
      * @param handler the client protocol handler.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param params HTTP parameters.
      */
     public SSLClientIOEventDispatch(
             final NHttpClientHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final HttpParams params) {
-        this(handler, sslcontext, null, params);
+        this(handler, sslContext, null, params);
     }
 
     /**
@@ -162,15 +162,15 @@ public class SSLClientIOEventDispatch implements IOEventDispatch {
      * a different implementation of SSL I/O session.
      *
      * @param session the underlying I/O session.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param sslHandler the SSL handler.
      * @return newly created SSL I/O session.
      */
     protected SSLIOSession createSSLIOSession(
             final IOSession session,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLIOSessionHandler sslHandler) {
-        return new SSLIOSession(session, sslcontext, sslHandler);
+        return new SSLIOSession(session, sslContext, sslHandler);
     }
 
     @Override
@@ -178,7 +178,7 @@ public class SSLClientIOEventDispatch implements IOEventDispatch {
 
         final SSLIOSession sslSession = createSSLIOSession(
                 session,
-                this.sslcontext,
+                this.sslContext,
                 this.sslHandler);
 
         final NHttpClientIOTarget conn = createConnection(

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d5a9fbc8/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLServerIOEventDispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLServerIOEventDispatch.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLServerIOEventDispatch.java
index 38f5af6..af388bf 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLServerIOEventDispatch.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLServerIOEventDispatch.java
@@ -61,7 +61,7 @@ public class SSLServerIOEventDispatch implements IOEventDispatch {
     private static final String SSL_SESSION = "SSL_SESSION";
 
     protected final NHttpServiceHandler handler;
-    protected final SSLContext sslcontext;
+    protected final SSLContext sslContext;
     protected final SSLIOSessionHandler sslHandler;
     protected final HttpParams params;
 
@@ -72,22 +72,22 @@ public class SSLServerIOEventDispatch implements IOEventDispatch {
      * protocol aspects for HTTP connections.
      *
      * @param handler the server protocol handler.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param sslHandler the SSL handler.
      * @param params HTTP parameters.
      */
     public SSLServerIOEventDispatch(
             final NHttpServiceHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLIOSessionHandler sslHandler,
             final HttpParams params) {
         super();
         Args.notNull(handler, "HTTP service handler");
-        Args.notNull(sslcontext, "SSL context");
+        Args.notNull(sslContext, "SSL context");
         Args.notNull(params, "HTTP parameters");
         this.handler = handler;
         this.params = params;
-        this.sslcontext = sslcontext;
+        this.sslContext = sslContext;
         this.sslHandler = sslHandler;
     }
 
@@ -98,14 +98,14 @@ public class SSLServerIOEventDispatch implements IOEventDispatch {
      * protocol aspects for HTTP connections.
      *
      * @param handler the server protocol handler.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param params HTTP parameters.
      */
     public SSLServerIOEventDispatch(
             final NHttpServiceHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final HttpParams params) {
-        this(handler, sslcontext, null, params);
+        this(handler, sslContext, null, params);
     }
 
     /**
@@ -162,15 +162,15 @@ public class SSLServerIOEventDispatch implements IOEventDispatch {
      * a different implementation of SSL I/O session.
      *
      * @param session the underlying I/O session.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param sslHandler the SSL handler.
      * @return newly created SSL I/O session.
      */
     protected SSLIOSession createSSLIOSession(
             final IOSession session,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLIOSessionHandler sslHandler) {
-        return new SSLIOSession(session, sslcontext, sslHandler);
+        return new SSLIOSession(session, sslContext, sslHandler);
     }
 
     @Override
@@ -178,7 +178,7 @@ public class SSLServerIOEventDispatch implements IOEventDispatch {
 
         final SSLIOSession sslSession = createSSLIOSession(
                 session,
-                this.sslcontext,
+                this.sslContext,
                 this.sslHandler);
 
         final NHttpServerIOTarget conn = createConnection(

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d5a9fbc8/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLClientIOEventDispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLClientIOEventDispatch.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLClientIOEventDispatch.java
index 578f54a..d7d87ab 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLClientIOEventDispatch.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLClientIOEventDispatch.java
@@ -51,7 +51,7 @@ import org.apache.http.util.Args;
 @Deprecated
 public class SSLClientIOEventDispatch extends DefaultClientIOEventDispatch {
 
-    private final SSLContext sslcontext;
+    private final SSLContext sslContext;
     private final SSLSetupHandler sslHandler;
 
     /**
@@ -61,19 +61,19 @@ public class SSLClientIOEventDispatch extends DefaultClientIOEventDispatch {
      * protocol aspects for HTTP connections.
      *
      * @param handler the client protocol handler.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param sslHandler the SSL setup handler.
      * @param params HTTP parameters.
      */
     public SSLClientIOEventDispatch(
             final NHttpClientHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final HttpParams params) {
         super(handler, params);
-        Args.notNull(sslcontext, "SSL context");
+        Args.notNull(sslContext, "SSL context");
         Args.notNull(params, "HTTP parameters");
-        this.sslcontext = sslcontext;
+        this.sslContext = sslContext;
         this.sslHandler = sslHandler;
     }
 
@@ -84,14 +84,14 @@ public class SSLClientIOEventDispatch extends DefaultClientIOEventDispatch {
      * protocol aspects for HTTP connections.
      *
      * @param handler the client protocol handler.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param params HTTP parameters.
      */
     public SSLClientIOEventDispatch(
             final NHttpClientHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final HttpParams params) {
-        this(handler, sslcontext, null, params);
+        this(handler, sslContext, null, params);
     }
 
     /**
@@ -102,15 +102,15 @@ public class SSLClientIOEventDispatch extends DefaultClientIOEventDispatch {
      * a different implementation of SSL I/O session.
      *
      * @param session the underlying I/O session.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param sslHandler the SSL setup handler.
      * @return newly created SSL I/O session.
      */
     protected SSLIOSession createSSLIOSession(
             final IOSession session,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler) {
-        return new SSLIOSession(session, sslcontext, sslHandler);
+        return new SSLIOSession(session, sslContext, sslHandler);
     }
 
     protected NHttpClientIOTarget createSSLConnection(final SSLIOSession ssliosession) {
@@ -119,7 +119,7 @@ public class SSLClientIOEventDispatch extends DefaultClientIOEventDispatch {
 
     @Override
     protected NHttpClientIOTarget createConnection(final IOSession session) {
-        final SSLIOSession ssliosession = createSSLIOSession(session, this.sslcontext, this.sslHandler);
+        final SSLIOSession ssliosession = createSSLIOSession(session, this.sslContext, this.sslHandler);
         session.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
         final NHttpClientIOTarget conn = createSSLConnection(ssliosession);
         try {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d5a9fbc8/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLServerIOEventDispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLServerIOEventDispatch.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLServerIOEventDispatch.java
index c3a4c37..cf1d413 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLServerIOEventDispatch.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLServerIOEventDispatch.java
@@ -51,7 +51,7 @@ import org.apache.http.util.Args;
 @Deprecated
 public class SSLServerIOEventDispatch extends DefaultServerIOEventDispatch {
 
-    private final SSLContext sslcontext;
+    private final SSLContext sslContext;
     private final SSLSetupHandler sslHandler;
 
     /**
@@ -61,19 +61,19 @@ public class SSLServerIOEventDispatch extends DefaultServerIOEventDispatch {
      * protocol aspects for HTTP connections.
      *
      * @param handler the server protocol handler.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param sslHandler the SSL setup handler.
      * @param params HTTP parameters.
      */
     public SSLServerIOEventDispatch(
             final NHttpServiceHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final HttpParams params) {
         super(handler, params);
-        Args.notNull(sslcontext, "SSL context");
+        Args.notNull(sslContext, "SSL context");
         Args.notNull(params, "HTTP parameters");
-        this.sslcontext = sslcontext;
+        this.sslContext = sslContext;
         this.sslHandler = sslHandler;
     }
 
@@ -84,14 +84,14 @@ public class SSLServerIOEventDispatch extends DefaultServerIOEventDispatch {
      * protocol aspects for HTTP connections.
      *
      * @param handler the server protocol handler.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param params HTTP parameters.
      */
     public SSLServerIOEventDispatch(
             final NHttpServiceHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final HttpParams params) {
-        this(handler, sslcontext, null, params);
+        this(handler, sslContext, null, params);
     }
 
     /**
@@ -102,15 +102,15 @@ public class SSLServerIOEventDispatch extends DefaultServerIOEventDispatch {
      * a different implementation of SSL I/O session.
      *
      * @param session the underlying I/O session.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param sslHandler the SSL setup handler.
      * @return newly created SSL I/O session.
      */
     protected SSLIOSession createSSLIOSession(
             final IOSession session,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler) {
-        return new SSLIOSession(session, sslcontext, sslHandler);
+        return new SSLIOSession(session, sslContext, sslHandler);
     }
 
     protected NHttpServerIOTarget createSSLConnection(final SSLIOSession ssliosession) {
@@ -119,7 +119,7 @@ public class SSLServerIOEventDispatch extends DefaultServerIOEventDispatch {
 
     @Override
     protected NHttpServerIOTarget createConnection(final IOSession session) {
-        final SSLIOSession ssliosession = createSSLIOSession(session, this.sslcontext, this.sslHandler);
+        final SSLIOSession ssliosession = createSSLIOSession(session, this.sslContext, this.sslHandler);
         session.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
         final NHttpServerIOTarget conn = createSSLConnection(ssliosession);
         try {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d5a9fbc8/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
index e62ccdf..cfc0a10 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
@@ -90,10 +90,10 @@ public class DefaultHttpClientIODispatch
     @Deprecated
     public DefaultHttpClientIODispatch(
             final NHttpClientEventHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final HttpParams params) {
-        this(handler, new SSLNHttpClientConnectionFactory(sslcontext, sslHandler, params));
+        this(handler, new SSLNHttpClientConnectionFactory(sslContext, sslHandler, params));
     }
 
     /**
@@ -103,9 +103,9 @@ public class DefaultHttpClientIODispatch
     @Deprecated
     public DefaultHttpClientIODispatch(
             final NHttpClientEventHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final HttpParams params) {
-        this(handler, sslcontext, null, params);
+        this(handler, sslContext, null, params);
     }
 
     /**
@@ -120,10 +120,10 @@ public class DefaultHttpClientIODispatch
      */
     public DefaultHttpClientIODispatch(
             final NHttpClientEventHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final ConnectionConfig config) {
-        this(handler, new SSLNHttpClientConnectionFactory(sslcontext, sslHandler, config));
+        this(handler, new SSLNHttpClientConnectionFactory(sslContext, sslHandler, config));
     }
 
     /**
@@ -131,9 +131,9 @@ public class DefaultHttpClientIODispatch
      */
     public DefaultHttpClientIODispatch(
             final NHttpClientEventHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final ConnectionConfig config) {
-        this(handler, new SSLNHttpClientConnectionFactory(sslcontext, null, config));
+        this(handler, new SSLNHttpClientConnectionFactory(sslContext, null, config));
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d5a9fbc8/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
index e109b64..a49b1b3 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
@@ -83,10 +83,10 @@ public class DefaultHttpServerIODispatch
     @Deprecated
     public DefaultHttpServerIODispatch(
             final NHttpServerEventHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final HttpParams params) {
-        this(handler, new SSLNHttpServerConnectionFactory(sslcontext, sslHandler, params));
+        this(handler, new SSLNHttpServerConnectionFactory(sslContext, sslHandler, params));
     }
 
     /**
@@ -96,9 +96,9 @@ public class DefaultHttpServerIODispatch
     @Deprecated
     public DefaultHttpServerIODispatch(
             final NHttpServerEventHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final HttpParams params) {
-        this(handler, sslcontext, null, params);
+        this(handler, sslContext, null, params);
     }
 
     /**
@@ -113,10 +113,10 @@ public class DefaultHttpServerIODispatch
      */
     public DefaultHttpServerIODispatch(
             final NHttpServerEventHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final ConnectionConfig config) {
-        this(handler, new SSLNHttpServerConnectionFactory(sslcontext, sslHandler, config));
+        this(handler, new SSLNHttpServerConnectionFactory(sslContext, sslHandler, config));
     }
 
     /**
@@ -124,9 +124,9 @@ public class DefaultHttpServerIODispatch
      */
     public DefaultHttpServerIODispatch(
             final NHttpServerEventHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final ConnectionConfig config) {
-        this(handler, new SSLNHttpServerConnectionFactory(sslcontext, null, config));
+        this(handler, new SSLNHttpServerConnectionFactory(sslContext, null, config));
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d5a9fbc8/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLContextUtils.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLContextUtils.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLContextUtils.java
index fea5a4e..079a31f 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLContextUtils.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLContextUtils.java
@@ -33,18 +33,18 @@ import java.security.NoSuchAlgorithmException;
 class SSLContextUtils {
 
     static SSLContext getDefault() {
-        SSLContext sslcontext;
+        SSLContext sslContext;
         try {
             try {
-                sslcontext = SSLContext.getInstance("Default");
+                sslContext = SSLContext.getInstance("Default");
             }  catch (final NoSuchAlgorithmException ex) {
-                sslcontext = SSLContext.getInstance("TLS");
+                sslContext = SSLContext.getInstance("TLS");
             }
-            sslcontext.init(null, null, null);
+            sslContext.init(null, null, null);
         } catch (final Exception ex) {
             throw new IllegalStateException("Failure initializing default SSL context", ex);
         }
-        return sslcontext;
+        return sslContext;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d5a9fbc8/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java
index 5b28579..6c3af86 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java
@@ -70,7 +70,7 @@ public class SSLNHttpClientConnectionFactory
     private final NHttpMessageParserFactory<HttpResponse> responseParserFactory;
     private final NHttpMessageWriterFactory<HttpRequest> requestWriterFactory;
     private final ByteBufferAllocator allocator;
-    private final SSLContext sslcontext;
+    private final SSLContext sslContext;
     private final SSLSetupHandler sslHandler;
     private final ConnectionConfig cconfig;
 
@@ -82,7 +82,7 @@ public class SSLNHttpClientConnectionFactory
      */
     @Deprecated
     public SSLNHttpClientConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final HttpResponseFactory responseFactory,
             final ByteBufferAllocator allocator,
@@ -91,7 +91,7 @@ public class SSLNHttpClientConnectionFactory
         Args.notNull(responseFactory, "HTTP response factory");
         Args.notNull(allocator, "Byte buffer allocator");
         Args.notNull(params, "HTTP parameters");
-        this.sslcontext = sslcontext != null ? sslcontext : SSLContexts.createSystemDefault();
+        this.sslContext = sslContext != null ? sslContext : SSLContexts.createSystemDefault();
         this.sslHandler = sslHandler;
         this.allocator = allocator;
         this.incomingContentStrategy = null;
@@ -108,10 +108,10 @@ public class SSLNHttpClientConnectionFactory
      */
     @Deprecated
     public SSLNHttpClientConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final HttpParams params) {
-        this(sslcontext, sslHandler, DefaultHttpResponseFactory.INSTANCE,
+        this(sslContext, sslHandler, DefaultHttpResponseFactory.INSTANCE,
                 HeapByteBufferAllocator.INSTANCE, params);
     }
 
@@ -128,7 +128,7 @@ public class SSLNHttpClientConnectionFactory
      * @since 4.3
      */
     public SSLNHttpClientConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final ContentLengthStrategy incomingContentStrategy,
             final ContentLengthStrategy outgoingContentStrategy,
@@ -137,7 +137,7 @@ public class SSLNHttpClientConnectionFactory
             final ByteBufferAllocator allocator,
             final ConnectionConfig cconfig) {
         super();
-        this.sslcontext = sslcontext != null ? sslcontext : SSLContexts.createSystemDefault();
+        this.sslContext = sslContext != null ? sslContext : SSLContexts.createSystemDefault();
         this.sslHandler = sslHandler;
         this.incomingContentStrategy = incomingContentStrategy;
         this.outgoingContentStrategy = outgoingContentStrategy;
@@ -151,13 +151,13 @@ public class SSLNHttpClientConnectionFactory
      * @since 4.3
      */
     public SSLNHttpClientConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final NHttpMessageParserFactory<HttpResponse> responseParserFactory,
             final NHttpMessageWriterFactory<HttpRequest> requestWriterFactory,
             final ByteBufferAllocator allocator,
             final ConnectionConfig cconfig) {
-        this(sslcontext, sslHandler,
+        this(sslContext, sslHandler,
                 null, null, responseParserFactory, requestWriterFactory, allocator, cconfig);
     }
 
@@ -165,12 +165,12 @@ public class SSLNHttpClientConnectionFactory
      * @since 4.3
      */
     public SSLNHttpClientConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final NHttpMessageParserFactory<HttpResponse> responseParserFactory,
             final NHttpMessageWriterFactory<HttpRequest> requestWriterFactory,
             final ConnectionConfig cconfig) {
-        this(sslcontext, sslHandler,
+        this(sslContext, sslHandler,
                 null, null, responseParserFactory, requestWriterFactory, null, cconfig);
     }
 
@@ -178,10 +178,10 @@ public class SSLNHttpClientConnectionFactory
      * @since 4.3
      */
     public SSLNHttpClientConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final ConnectionConfig config) {
-        this(sslcontext, sslHandler, null, null, null, null, null, config);
+        this(sslContext, sslHandler, null, null, null, null, null, config);
     }
 
     /**
@@ -215,16 +215,16 @@ public class SSLNHttpClientConnectionFactory
      */
     protected SSLIOSession createSSLIOSession(
             final IOSession iosession,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler) {
         final SSLIOSession ssliosession = new SSLIOSession(iosession, SSLMode.CLIENT,
-                sslcontext, sslHandler);
+                sslContext, sslHandler);
         return ssliosession;
     }
 
     @Override
     public DefaultNHttpClientConnection createConnection(final IOSession iosession) {
-        final SSLIOSession ssliosession = createSSLIOSession(iosession, this.sslcontext, this.sslHandler);
+        final SSLIOSession ssliosession = createSSLIOSession(iosession, this.sslContext, this.sslHandler);
         iosession.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
         return new DefaultNHttpClientConnection(
                 ssliosession,

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d5a9fbc8/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java
index 99576f3..294f8af 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java
@@ -63,7 +63,7 @@ import org.apache.http.util.Args;
 public class SSLNHttpServerConnectionFactory
     implements NHttpConnectionFactory<DefaultNHttpServerConnection> {
 
-    private final SSLContext sslcontext;
+    private final SSLContext sslContext;
     private final SSLSetupHandler sslHandler;
     private final ContentLengthStrategy incomingContentStrategy;
     private final ContentLengthStrategy outgoingContentStrategy;
@@ -80,7 +80,7 @@ public class SSLNHttpServerConnectionFactory
      */
     @Deprecated
     public SSLNHttpServerConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final HttpRequestFactory requestFactory,
             final ByteBufferAllocator allocator,
@@ -89,7 +89,7 @@ public class SSLNHttpServerConnectionFactory
         Args.notNull(requestFactory, "HTTP request factory");
         Args.notNull(allocator, "Byte buffer allocator");
         Args.notNull(params, "HTTP parameters");
-        this.sslcontext = sslcontext != null ? sslcontext : SSLContexts.createSystemDefault();
+        this.sslContext = sslContext != null ? sslContext : SSLContexts.createSystemDefault();
         this.sslHandler = sslHandler;
         this.incomingContentStrategy = null;
         this.outgoingContentStrategy = null;
@@ -106,10 +106,10 @@ public class SSLNHttpServerConnectionFactory
      */
     @Deprecated
     public SSLNHttpServerConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final HttpParams params) {
-        this(sslcontext, sslHandler, DefaultHttpRequestFactory.INSTANCE,
+        this(sslContext, sslHandler, DefaultHttpRequestFactory.INSTANCE,
                 HeapByteBufferAllocator.INSTANCE, params);
     }
 
@@ -126,7 +126,7 @@ public class SSLNHttpServerConnectionFactory
      * @since 4.3
      */
     public SSLNHttpServerConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final ContentLengthStrategy incomingContentStrategy,
             final ContentLengthStrategy outgoingContentStrategy,
@@ -135,7 +135,7 @@ public class SSLNHttpServerConnectionFactory
             final ByteBufferAllocator allocator,
             final ConnectionConfig cconfig) {
         super();
-        this.sslcontext = sslcontext != null ? sslcontext : SSLContexts.createSystemDefault();
+        this.sslContext = sslContext != null ? sslContext : SSLContexts.createSystemDefault();
         this.sslHandler = sslHandler;
         this.incomingContentStrategy = incomingContentStrategy;
         this.outgoingContentStrategy = outgoingContentStrategy;
@@ -149,13 +149,13 @@ public class SSLNHttpServerConnectionFactory
      * @since 4.3
      */
     public SSLNHttpServerConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final NHttpMessageParserFactory<HttpRequest> requestParserFactory,
             final NHttpMessageWriterFactory<HttpResponse> responseWriterFactory,
             final ByteBufferAllocator allocator,
             final ConnectionConfig cconfig) {
-        this(sslcontext, sslHandler,
+        this(sslContext, sslHandler,
                 null, null, requestParserFactory, responseWriterFactory, allocator, cconfig);
     }
 
@@ -163,12 +163,12 @@ public class SSLNHttpServerConnectionFactory
      * @since 4.3
      */
     public SSLNHttpServerConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final NHttpMessageParserFactory<HttpRequest> requestParserFactory,
             final NHttpMessageWriterFactory<HttpResponse> responseWriterFactory,
             final ConnectionConfig cconfig) {
-        this(sslcontext, sslHandler,
+        this(sslContext, sslHandler,
                 null, null, requestParserFactory, responseWriterFactory, null, cconfig);
     }
 
@@ -176,10 +176,10 @@ public class SSLNHttpServerConnectionFactory
      * @since 4.3
      */
     public SSLNHttpServerConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final ConnectionConfig config) {
-        this(sslcontext, sslHandler, null, null, null, null, null, config);
+        this(sslContext, sslHandler, null, null, null, null, null, config);
     }
 
     /**
@@ -213,16 +213,16 @@ public class SSLNHttpServerConnectionFactory
      */
     protected SSLIOSession createSSLIOSession(
             final IOSession iosession,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler) {
         final SSLIOSession ssliosession = new SSLIOSession(iosession, SSLMode.SERVER,
-                sslcontext, sslHandler);
+                sslContext, sslHandler);
         return ssliosession;
     }
 
     @Override
     public DefaultNHttpServerConnection createConnection(final IOSession iosession) {
-        final SSLIOSession ssliosession = createSSLIOSession(iosession, this.sslcontext, this.sslHandler);
+        final SSLIOSession ssliosession = createSSLIOSession(iosession, this.sslContext, this.sslHandler);
         iosession.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
         return new DefaultNHttpServerConnection(ssliosession,
                 this.cconfig.getBufferSize(),

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d5a9fbc8/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnFactory.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnFactory.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnFactory.java
index e3bdb7f..274897f 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnFactory.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnFactory.java
@@ -87,7 +87,7 @@ public class BasicNIOConnFactory implements NIOConnFactory<HttpHost, NHttpClient
      */
     @Deprecated
     public BasicNIOConnFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final HttpResponseFactory responseFactory,
             final ByteBufferAllocator allocator,
@@ -95,7 +95,7 @@ public class BasicNIOConnFactory implements NIOConnFactory<HttpHost, NHttpClient
         this(new DefaultNHttpClientConnectionFactory(
                 responseFactory, allocator, params),
                 new SSLNHttpClientConnectionFactory(
-                        sslcontext, sslHandler, responseFactory, allocator, params));
+                        sslContext, sslHandler, responseFactory, allocator, params));
     }
 
     /**
@@ -104,10 +104,10 @@ public class BasicNIOConnFactory implements NIOConnFactory<HttpHost, NHttpClient
      */
     @Deprecated
     public BasicNIOConnFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final HttpParams params) {
-        this(sslcontext, sslHandler,
+        this(sslContext, sslHandler,
                 DefaultHttpResponseFactory.INSTANCE, HeapByteBufferAllocator.INSTANCE, params);
     }
 
@@ -123,7 +123,7 @@ public class BasicNIOConnFactory implements NIOConnFactory<HttpHost, NHttpClient
      * @since 4.3
      */
     public BasicNIOConnFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final NHttpMessageParserFactory<HttpResponse> responseParserFactory,
             final NHttpMessageWriterFactory<HttpRequest> requestWriterFactory,
@@ -132,7 +132,7 @@ public class BasicNIOConnFactory implements NIOConnFactory<HttpHost, NHttpClient
         this(new DefaultNHttpClientConnectionFactory(
                     responseParserFactory, requestWriterFactory, allocator, config),
                 new SSLNHttpClientConnectionFactory(
-                        sslcontext, sslHandler, responseParserFactory, requestWriterFactory,
+                        sslContext, sslHandler, responseParserFactory, requestWriterFactory,
                         allocator, config));
     }
 
@@ -140,10 +140,10 @@ public class BasicNIOConnFactory implements NIOConnFactory<HttpHost, NHttpClient
      * @since 4.3
      */
     public BasicNIOConnFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final ConnectionConfig config) {
-        this(sslcontext, sslHandler, null, null, null, config);
+        this(sslContext, sslHandler, null, null, null, config);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d5a9fbc8/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
index e47cf11..68951ad 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
@@ -62,10 +62,10 @@ import org.apache.http.util.Asserts;
  * The resultant instance of {@code SSLIOSession} must be added to the original
  * I/O session as an attribute with the {@link #SESSION_KEY} key.
  * <pre>
- *  SSLContext sslcontext = SSLContext.getInstance("SSL");
- *  sslcontext.init(null, null, null);
+ *  SSLContext sslContext = SSLContext.getInstance("SSL");
+ *  sslContext.init(null, null, null);
  *  SSLIOSession sslsession = new SSLIOSession(
- *      iosession, SSLMode.CLIENT, sslcontext, null);
+ *      iosession, SSLMode.CLIENT, sslContext, null);
  *  iosession.setAttribute(SSLIOSession.SESSION_KEY, sslsession);
  * </pre>
  *

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d5a9fbc8/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java b/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java
index 22bf4dc..0042772 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java
@@ -37,18 +37,18 @@ import org.apache.http.nio.reactor.ssl.SSLSetupHandler;
 
 public class ClientConnectionFactory implements NHttpConnectionFactory<DefaultNHttpClientConnection> {
 
-    private final SSLContext sslcontext;
+    private final SSLContext sslContext;
     private final SSLSetupHandler setupHandler;
 
     public ClientConnectionFactory(
-            final SSLContext sslcontext, final SSLSetupHandler setupHandler) {
+            final SSLContext sslContext, final SSLSetupHandler setupHandler) {
         super();
-        this.sslcontext = sslcontext;
+        this.sslContext = sslContext;
         this.setupHandler = setupHandler;
     }
 
-    public ClientConnectionFactory(final SSLContext sslcontext) {
-        this(sslcontext, null);
+    public ClientConnectionFactory(final SSLContext sslContext) {
+        this(sslContext, null);
     }
 
     public ClientConnectionFactory() {
@@ -57,9 +57,9 @@ public class ClientConnectionFactory implements NHttpConnectionFactory<DefaultNH
 
     @Override
     public DefaultNHttpClientConnection createConnection(final IOSession iosession) {
-        if (this.sslcontext != null) {
+        if (this.sslContext != null) {
             final SSLIOSession ssliosession = new SSLIOSession(
-                    iosession, SSLMode.CLIENT, this.sslcontext, this.setupHandler);
+                    iosession, SSLMode.CLIENT, this.sslContext, this.setupHandler);
             iosession.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
             return new LoggingNHttpClientConnection(ssliosession);
         } else {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d5a9fbc8/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java b/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java
index a64e8ae..4c0b174 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java
@@ -37,18 +37,18 @@ import org.apache.http.nio.reactor.ssl.SSLSetupHandler;
 
 public class ServerConnectionFactory implements NHttpConnectionFactory<DefaultNHttpServerConnection> {
 
-    private final SSLContext sslcontext;
+    private final SSLContext sslContext;
     private final SSLSetupHandler setupHandler;
 
     public ServerConnectionFactory(
-            final SSLContext sslcontext, final SSLSetupHandler setupHandler) {
+            final SSLContext sslContext, final SSLSetupHandler setupHandler) {
         super();
-        this.sslcontext = sslcontext;
+        this.sslContext = sslContext;
         this.setupHandler = setupHandler;
     }
 
-    public ServerConnectionFactory(final SSLContext sslcontext) {
-        this(sslcontext, null);
+    public ServerConnectionFactory(final SSLContext sslContext) {
+        this(sslContext, null);
     }
 
     public ServerConnectionFactory() {
@@ -57,9 +57,9 @@ public class ServerConnectionFactory implements NHttpConnectionFactory<DefaultNH
 
     @Override
     public DefaultNHttpServerConnection createConnection(final IOSession iosession) {
-        if (this.sslcontext != null) {
+        if (this.sslContext != null) {
             final SSLIOSession ssliosession = new SSLIOSession(
-                    iosession, SSLMode.SERVER, this.sslcontext, this.setupHandler);
+                    iosession, SSLMode.SERVER, this.sslContext, this.setupHandler);
             iosession.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
             return new LoggingNHttpServerConnection(ssliosession);
         } else {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d5a9fbc8/httpcore/src/examples/org/apache/http/examples/HttpFileServer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/examples/org/apache/http/examples/HttpFileServer.java b/httpcore/src/examples/org/apache/http/examples/HttpFileServer.java
index 6dd7af3..4c9c725 100644
--- a/httpcore/src/examples/org/apache/http/examples/HttpFileServer.java
+++ b/httpcore/src/examples/org/apache/http/examples/HttpFileServer.java
@@ -77,7 +77,7 @@ public class HttpFileServer {
             port = Integer.parseInt(args[1]);
         }
 
-        SSLContext sslcontext = null;
+        SSLContext sslContext = null;
         if (port == 8443) {
             // Initialize SSL context
             URL url = HttpFileServer.class.getResource("/my.keystore");
@@ -85,7 +85,7 @@ public class HttpFileServer {
                 System.out.println("Keystore not found");
                 System.exit(1);
             }
-            sslcontext = SSLContexts.custom()
+            sslContext = SSLContexts.custom()
                     .loadKeyMaterial(url, "secret".toCharArray(), "secret".toCharArray())
                     .build();
         }
@@ -99,7 +99,7 @@ public class HttpFileServer {
                 .setListenerPort(port)
                 .setServerInfo("Test/1.1")
                 .setSocketConfig(socketConfig)
-                .setSslContext(sslcontext)
+                .setSslContext(sslContext)
                 .setExceptionLogger(new StdErrorExceptionLogger())
                 .registerHandler("*", new HttpFileHandler(docRoot))
                 .create();

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d5a9fbc8/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
index 22ded79..87c5470 100644
--- a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
+++ b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
@@ -95,7 +95,7 @@ public class SSLContextBuilder {
 
     /**
      * Sets the SSLContext algorithm name.
-     * 
+     *
      * @param protocol
      *            the SSLContext algorithm name of the requested protocol. See
      *            the SSLContext section in the <a href=
@@ -276,26 +276,26 @@ public class SSLContextBuilder {
     }
 
     protected void initSSLContext(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final Collection<KeyManager> keyManagers,
             final Collection<TrustManager> trustManagers,
             final SecureRandom secureRandom) throws KeyManagementException {
-        sslcontext.init(
+        sslContext.init(
                 !keyManagers.isEmpty() ? keyManagers.toArray(new KeyManager[keyManagers.size()]) : null,
                 !trustManagers.isEmpty() ? trustManagers.toArray(new TrustManager[trustManagers.size()]) : null,
                 secureRandom);
     }
 
     public SSLContext build() throws NoSuchAlgorithmException, KeyManagementException {
-        final SSLContext sslcontext;
+        final SSLContext sslContext;
         final String protocolStr = this.protocol != null ? this.protocol : TLS;
         if (this.provider != null) {
-            sslcontext = SSLContext.getInstance(protocolStr, this.provider);
+            sslContext = SSLContext.getInstance(protocolStr, this.provider);
         } else {
-            sslcontext = SSLContext.getInstance(protocolStr);
+            sslContext = SSLContext.getInstance(protocolStr);
         }
-        initSSLContext(sslcontext, keymanagers, trustmanagers, secureRandom);
-        return sslcontext;
+        initSSLContext(sslContext, keymanagers, trustmanagers, secureRandom);
+        return sslContext;
     }
 
     static class TrustManagerDelegate implements X509TrustManager {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d5a9fbc8/httpcore/src/main/java/org/apache/http/ssl/SSLContexts.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/ssl/SSLContexts.java b/httpcore/src/main/java/org/apache/http/ssl/SSLContexts.java
index 3c0f35c..19a40df 100644
--- a/httpcore/src/main/java/org/apache/http/ssl/SSLContexts.java
+++ b/httpcore/src/main/java/org/apache/http/ssl/SSLContexts.java
@@ -48,9 +48,9 @@ public class SSLContexts {
      */
     public static SSLContext createDefault() throws SSLInitializationException {
         try {
-            final SSLContext sslcontext = SSLContext.getInstance(SSLContextBuilder.TLS);
-            sslcontext.init(null, null, null);
-            return sslcontext;
+            final SSLContext sslContext = SSLContext.getInstance(SSLContextBuilder.TLS);
+            sslContext.init(null, null, null);
+            return sslContext;
         } catch (final NoSuchAlgorithmException ex) {
             throw new SSLInitializationException(ex.getMessage(), ex);
         } catch (final KeyManagementException ex) {


[40/50] httpcomponents-core git commit: Revert: Rename variables "sslcontext" to "sslContext".

Posted by ol...@apache.org.
Revert: Rename variables "sslcontext" to "sslContext".

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1793943 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/0a543bb8
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/0a543bb8
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/0a543bb8

Branch: refs/heads/4.4.x
Commit: 0a543bb809cce902229bbbe5365210d78f34225d
Parents: 0ee4ac3
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri May 5 05:20:25 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri May 5 05:20:25 2017 +0000

----------------------------------------------------------------------
 .../org/apache/http/impl/nio/SSLClientIOEventDispatch.java     | 6 +++---
 .../org/apache/http/impl/nio/SSLServerIOEventDispatch.java     | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/0a543bb8/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLClientIOEventDispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLClientIOEventDispatch.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLClientIOEventDispatch.java
index b43bbb8..852f246 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLClientIOEventDispatch.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLClientIOEventDispatch.java
@@ -61,7 +61,7 @@ public class SSLClientIOEventDispatch implements IOEventDispatch {
     private static final String SSL_SESSION = "SSL_SESSION";
 
     protected final NHttpClientHandler handler;
-    protected final SSLContext sslContext;
+    protected final SSLContext sslcontext;
     protected final SSLIOSessionHandler sslHandler;
     protected final HttpParams params;
 
@@ -87,7 +87,7 @@ public class SSLClientIOEventDispatch implements IOEventDispatch {
         Args.notNull(params, "HTTP parameters");
         this.handler = handler;
         this.params = params;
-        this.sslContext = sslContext;
+        this.sslcontext = sslContext;
         this.sslHandler = sslHandler;
     }
 
@@ -178,7 +178,7 @@ public class SSLClientIOEventDispatch implements IOEventDispatch {
 
         final SSLIOSession sslSession = createSSLIOSession(
                 session,
-                this.sslContext,
+                this.sslcontext,
                 this.sslHandler);
 
         final NHttpClientIOTarget conn = createConnection(

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/0a543bb8/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLServerIOEventDispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLServerIOEventDispatch.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLServerIOEventDispatch.java
index af388bf..1e901dc 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLServerIOEventDispatch.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLServerIOEventDispatch.java
@@ -61,7 +61,7 @@ public class SSLServerIOEventDispatch implements IOEventDispatch {
     private static final String SSL_SESSION = "SSL_SESSION";
 
     protected final NHttpServiceHandler handler;
-    protected final SSLContext sslContext;
+    protected final SSLContext sslcontext;
     protected final SSLIOSessionHandler sslHandler;
     protected final HttpParams params;
 
@@ -87,7 +87,7 @@ public class SSLServerIOEventDispatch implements IOEventDispatch {
         Args.notNull(params, "HTTP parameters");
         this.handler = handler;
         this.params = params;
-        this.sslContext = sslContext;
+        this.sslcontext = sslContext;
         this.sslHandler = sslHandler;
     }
 
@@ -178,7 +178,7 @@ public class SSLServerIOEventDispatch implements IOEventDispatch {
 
         final SSLIOSession sslSession = createSSLIOSession(
                 session,
-                this.sslContext,
+                this.sslcontext,
                 this.sslHandler);
 
         final NHttpServerIOTarget conn = createConnection(


[18/50] httpcomponents-core git commit: HTTPCLIENT-1808: Fixing potential overflow for connection TTL Contributed by Andrew Shore

Posted by ol...@apache.org.
HTTPCLIENT-1808: Fixing potential overflow for connection TTL
Contributed by Andrew Shore <shorea at amazon.com>

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1780648 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/e555fabb
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/e555fabb
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/e555fabb

Branch: refs/heads/4.4.x
Commit: e555fabb7a2f0458cbe1cce3d5d6983f200bd018
Parents: 10331fe
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Sat Jan 28 09:50:13 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Sat Jan 28 09:50:13 2017 +0000

----------------------------------------------------------------------
 httpcore/src/main/java/org/apache/http/pool/PoolEntry.java   | 8 +++++---
 .../src/test/java/org/apache/http/pool/TestPoolEntry.java    | 6 ++++++
 2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/e555fabb/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java b/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java
index 31b8ee2..dad5139 100644
--- a/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java
+++ b/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java
@@ -26,12 +26,12 @@
  */
 package org.apache.http.pool;
 
-import java.util.concurrent.TimeUnit;
-
 import org.apache.http.annotation.Contract;
 import org.apache.http.annotation.ThreadingBehavior;
 import org.apache.http.util.Args;
 
+import java.util.concurrent.TimeUnit;
+
 /**
  * Pool entry containing a pool connection object along with its route.
  * <p>
@@ -85,7 +85,9 @@ public abstract class PoolEntry<T, C> {
         this.created = System.currentTimeMillis();
         this.updated = this.created;
         if (timeToLive > 0) {
-            this.validityDeadline = this.created + tunit.toMillis(timeToLive);
+            final long deadline = this.created + tunit.toMillis(timeToLive);
+            // If the above overflows then default to Long.MAX_VALUE
+            this.validityDeadline = deadline > 0 ? deadline : Long.MAX_VALUE;
         } else {
             this.validityDeadline = Long.MAX_VALUE;
         }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/e555fabb/httpcore/src/test/java/org/apache/http/pool/TestPoolEntry.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/pool/TestPoolEntry.java b/httpcore/src/test/java/org/apache/http/pool/TestPoolEntry.java
index 927f160..6bad38e 100644
--- a/httpcore/src/test/java/org/apache/http/pool/TestPoolEntry.java
+++ b/httpcore/src/test/java/org/apache/http/pool/TestPoolEntry.java
@@ -122,4 +122,10 @@ public class TestPoolEntry {
         entry1.updateExpiry(50L, null);
     }
 
+    @Test
+    public void testExpiryDoesNotOverflow() {
+        final MockPoolEntry entry = new MockPoolEntry("route1", Long.MAX_VALUE, TimeUnit.MILLISECONDS);
+        Assert.assertEquals(entry.getValidityDeadline(), Long.MAX_VALUE);
+    }
+
 }