Skip to content

Commit

Permalink
Stream ssl_preread: added SSLv2 Client Hello support.
Browse files Browse the repository at this point in the history
In particular, it was not possible to obtain SSLv2 protocol version.
  • Loading branch information
pluknet committed Jul 18, 2018
1 parent 372b624 commit b93931a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/stream/ngx_stream_ssl_preread_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ ngx_stream_ssl_preread_handler(ngx_stream_session_t *s)

while (last - p >= 5) {

if ((p[0] & 0x80) && p[2] == 1 && (p[3] == 0 || p[3] == 3)) {
ngx_log_debug0(NGX_LOG_DEBUG_STREAM, ctx->log, 0,
"ssl preread: version 2 ClientHello");
ctx->version[0] = p[3];
ctx->version[1] = p[4];
return NGX_OK;
}

if (p[0] != 0x16) {
ngx_log_debug0(NGX_LOG_DEBUG_STREAM, ctx->log, 0,
"ssl preread: not a handshake");
Expand Down Expand Up @@ -507,8 +515,12 @@ ngx_stream_ssl_preread_protocol_variable(ngx_stream_session_t *s,
ngx_str_null(&version);

switch (ctx->version[0]) {
case 2:
ngx_str_set(&version, "SSLv2");
case 0:
switch (ctx->version[1]) {
case 2:
ngx_str_set(&version, "SSLv2");
break;
}
break;
case 3:
switch (ctx->version[1]) {
Expand Down

0 comments on commit b93931a

Please sign in to comment.