Skip to content

Instantly share code, notes, and snippets.

@kazuho
Created July 6, 2018 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazuho/faeea2d37f228684fb7427c81be85293 to your computer and use it in GitHub Desktop.
Save kazuho/faeea2d37f228684fb7427c81be85293 to your computer and use it in GitHub Desktop.
static int save_client_hello(ptls_on_client_hello_t *self, ptls_t *tls, ptls_iovec_t server_name, const ptls_iovec_t *protocols,
size_t num_protocols, const uint16_t *signature_algorithms, size_t num_signature_algorithms)
{
ptls_set_server_name(tls, (const char *)server_name.base, server_name.len);
#if 0 // you might want to save ALPN as well
ptls_set_negotiated_protocol(tls, (const char *)protocols[0].base, protocols[0].len);
#endif
return 0;
}
static ptls_context_t ctx = ...;
static ptls_on_client_hello_t on_client_hello = {save_client_hello};
ctx.on_client_hello = &on_client_hello;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment