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/11 18:17:39 UTC
[04/42] 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
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/171dc847
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/171dc847
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/171dc847
Branch: refs/heads/4.4.x
Commit: 171dc847678d1c08713289ca0d9daeaf1f2dd8d8
Parents: e1f4777
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Mon Jan 23 19:59:46 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Thu May 11 20:16:42 2017 +0200
----------------------------------------------------------------------
.../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/171dc847/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) {