RFR: 8373677: Clear text HttpServer connection could fail fast if receiving SSL ClientHello [v3]
Jaikiran Pai
jpai at openjdk.org
Wed Dec 17 11:20:55 UTC 2025
On Wed, 17 Dec 2025 10:58:29 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> The first byte of a SSL ClientHello handshake record is 0x16 (22).
>> If the first byte received on a HTTP/1.1 clear connection is 0x16, the HTTP server could fail fast, return 400 bad request and immediately close the connection.
>>
>> This changeset extends the fail fast behaviour for other ineligible bytes, such as any byte corresponding to ASCII characters <= 31.
>
> Daniel Fuchs has updated the pull request incrementally with two additional commits since the last revision:
>
> - Update test/jdk/com/sun/net/httpserver/ClearTextServerSSL.java
>
> Co-authored-by: Andrey Turbanov <turbanoff at gmail.com>
> - Update src/jdk.httpserver/share/classes/sun/net/httpserver/Request.java
>
> Co-authored-by: Andrey Turbanov <turbanoff at gmail.com>
src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java line 743:
> 741: } catch (ProtocolException pe) {
> 742: logger.log(Level.DEBUG, pe.toString());
> 743: logger.log(Level.DEBUG, "Bad first char in request line: closing");
Could we perhaps combine these 2 lines into one:
logger.log(Level.DEBUG, "closing due to: " + pe.toString());
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28827#discussion_r2626659192
More information about the net-dev
mailing list