Mercurial > hg > nginx
comparison src/event/ngx_event_openssl.c @ 7935:eb6c77e6d55d
SSL: added $ssl_alpn_protocol variable.
The variable contains protocol selected by ALPN during handshake and
is empty otherwise.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Thu, 14 Oct 2021 11:46:23 +0300 |
parents | dda421871bc2 |
children | b9e02e9b2f1d |
comparison
equal
deleted
inserted
replaced
7934:61abb35bb8cf | 7935:eb6c77e6d55d |
---|---|
4697 return NGX_OK; | 4697 return NGX_OK; |
4698 } | 4698 } |
4699 | 4699 |
4700 | 4700 |
4701 ngx_int_t | 4701 ngx_int_t |
4702 ngx_ssl_get_alpn_protocol(ngx_connection_t *c, ngx_pool_t *pool, ngx_str_t *s) | |
4703 { | |
4704 #ifdef TLSEXT_TYPE_application_layer_protocol_negotiation | |
4705 | |
4706 unsigned int len; | |
4707 const unsigned char *data; | |
4708 | |
4709 SSL_get0_alpn_selected(c->ssl->connection, &data, &len); | |
4710 | |
4711 if (len > 0) { | |
4712 | |
4713 s->data = ngx_pnalloc(pool, len); | |
4714 if (s->data == NULL) { | |
4715 return NGX_ERROR; | |
4716 } | |
4717 | |
4718 ngx_memcpy(s->data, data, len); | |
4719 s->len = len; | |
4720 | |
4721 return NGX_OK; | |
4722 } | |
4723 | |
4724 #endif | |
4725 | |
4726 s->len = 0; | |
4727 return NGX_OK; | |
4728 } | |
4729 | |
4730 | |
4731 ngx_int_t | |
4702 ngx_ssl_get_raw_certificate(ngx_connection_t *c, ngx_pool_t *pool, ngx_str_t *s) | 4732 ngx_ssl_get_raw_certificate(ngx_connection_t *c, ngx_pool_t *pool, ngx_str_t *s) |
4703 { | 4733 { |
4704 size_t len; | 4734 size_t len; |
4705 BIO *bio; | 4735 BIO *bio; |
4706 X509 *cert; | 4736 X509 *cert; |