Skip to content

Commit

Permalink
[bugfix] server was not responding after SSL session resumption (#18 #39
Browse files Browse the repository at this point in the history
)
  • Loading branch information
kazuho committed Oct 14, 2014
1 parent 85990ae commit fc5ecd4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/http1.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ static void reqread_on_timeout(h2o_timeout_entry_t *entry)

static inline void reqread_start(h2o_http1_conn_t *conn)
{
if (conn->sock->input != NULL && conn->sock->input->size != 0) {
if (handle_incoming_request(conn) == 0) {
return;
}
}
set_timeout(conn, &conn->super.ctx->req_timeout, reqread_on_timeout);
h2o_socket_read_start(conn->sock, reqread_on_read);
}
Expand Down Expand Up @@ -290,11 +295,6 @@ static void on_send_complete(h2o_socket_t *sock, int status)
h2o_consume_input_buffer(&conn->sock->input, conn->_reqsize);
conn->_prevreqlen = 0;
conn->_reqsize = 0;
if (conn->sock->input->size != 0) {
if (handle_incoming_request(conn) == 0) {
return;
}
}
reqread_start(conn);
}

Expand Down
6 changes: 6 additions & 0 deletions lib/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ int decode_ssl_input(h2o_socket_t *sock)
}
}

assert(sock->ssl->input.encrypted->size == 0);
return 0;
}

Expand Down Expand Up @@ -268,6 +269,7 @@ static void on_handshake_complete(h2o_socket_t *sock, int status)
h2o_socket_cb handshake_cb = sock->ssl->handshake.cb;
sock->_cb.write = NULL;
sock->ssl->handshake.cb = NULL;
decode_ssl_input(sock);
handshake_cb(sock, status);
}

Expand All @@ -293,6 +295,10 @@ static void proceed_handshake(h2o_socket_t *sock, int status)
h2o_socket_read_stop(sock);
flush_pending_ssl(sock, ret == 1 ? on_handshake_complete : proceed_handshake);
} else {
if (ret == 1) {
goto Complete;
}
assert(sock->ssl->input.encrypted == NULL || sock->ssl->input.encrypted->size == 0);
h2o_socket_read_start(sock, proceed_handshake);
}
return;
Expand Down

0 comments on commit fc5ecd4

Please sign in to comment.