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/01/23 20:00:18 UTC
svn commit: r1779967 -
/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
Author: olegk
Date: Mon Jan 23 20:00:17 2017
New Revision: 1779967
URL: http://svn.apache.org/viewvc?rev=1779967&view=rev
Log:
HTTPCORE-442: Non-blocking SSL sessions fail to decrypt buffered input data in some cases if closed by the opposite endpoint
Modified:
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java?rev=1779967&r1=1779966&r2=1779967&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java Mon Jan 23 20:00:17 2017
@@ -447,19 +447,20 @@ public class SSLIOSession implements IOS
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) {