Skip to content

Commit

Permalink
record if ESNI was used
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuho committed Jul 6, 2018
1 parent 9a80f72 commit b11d7b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/picotls.h
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,10 @@ typedef struct st_ptls_handshake_properties_t {
* if retry should be stateless (cookie.key MUST be set when this option is used)
*/
unsigned retry_uses_cookie : 1;
/**
* if esni was used
*/
unsigned esni : 1;
} server;
};
/**
Expand Down
3 changes: 3 additions & 0 deletions lib/picotls.c
Original file line number Diff line number Diff line change
Expand Up @@ -3188,12 +3188,15 @@ static int server_handle_hello(ptls_t *tls, struct st_ptls_message_emitter_t *em
memcpy(tls->client_random, ch.random_bytes, sizeof(tls->client_random));
ptls_iovec_t server_name = {NULL};
int should_free_server_name = 0;
properties->server.esni = 0;
if (ch.server_name.base != NULL) {
server_name = ch.server_name;
} else if (ch.esni.cipher != NULL && tls->ctx->esni != NULL) {
if ((ret = client_hello_decode_esni(tls->ctx, &key_share.algorithm, &key_share.peer_key, &server_name, &ch)) != 0)
goto Exit;
should_free_server_name = 1;
if (properties != NULL)
properties->server.esni = 1;
}
if (tls->ctx->on_client_hello != NULL) {
ret = tls->ctx->on_client_hello->cb(tls->ctx->on_client_hello, tls, server_name, ch.alpn.list, ch.alpn.count,
Expand Down

0 comments on commit b11d7b8

Please sign in to comment.