You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add exception handling for TLS half-close in ApacheHTTPClient #5385 (#5398)
* Check if input is shut down before writing (#5257)
This commit adds a wrapper socket that ensures the read end of the socket is
still open before performing a {@code write()}. In TLS 1.3, it is permitted for
the connection to be in a half-closed state, which is dangerous for the Apache
client because it can get stuck in a state where it continues to write to the
socket and potentially end up a blocked state writing to the socket
indefinitely.
* Delegate write() methods directly to base
* Added test cases to test TLS half close
* feat: Add exception handling for TLS half-close in ApacheHTTPClient
Implemented a feature to handle TLS half-close scenarios by throwing an exception in the ApacheHTTPClient package. In TLS 1.3, the inbound and outbound close_notify alerts are independent. When the client receives a close_notify alert, it only closes the inbound stream but continues to send data to the server. Previously, the SDK could not detect that the connection was closed on the server side, causing it to get stuck while writing to the socket and eventually timing out. This feature ensures proper detection and handling of closed connections, improving overall reliability by preventing client hangs.
* Handled review comemnts
* Updated test case to consider Jdk 1.8 builds which donot support TLS1.3 half close
---------
Co-authored-by: Dongie Agnir <[email protected]>
Co-authored-by: Dongie Agnir <[email protected]>
"description": "Added fix to handle TLS half-close scenarios by throwing an exception. In TLS 1.3, the inbound and outbound close_notify alerts are independent. When the client receives a close_notify alert, it only closes the inbound stream but continues to send data to the server. Previously, the SDK could not detect that the connection was closed on the server side, causing it to get stuck while writing to the socket and eventually timing out. With this bug fix, the SDK will now detect the closed connection and throw an appropriate exception, preventing client hangs and improving overall reliability."
Copy file name to clipboardExpand all lines: http-clients/apache-client/src/main/java/software/amazon/awssdk/http/apache/internal/conn/SdkTlsSocketFactory.java
0 commit comments