comparison src/http/ngx_http_request.c @ 5545:01e2a5bcdd8f

SSL: support ALPN (IETF's successor to NPN). Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
author Piotr Sikora <piotr@cloudflare.com>
date Tue, 28 Jan 2014 15:33:49 -0800
parents fdb67cfc957d
children 2e40188f83ef
comparison
equal deleted inserted replaced
5544:2f586f1684fa 5545:01e2a5bcdd8f
703 * Opera and recent Mozilla send the alert. 703 * Opera and recent Mozilla send the alert.
704 */ 704 */
705 705
706 c->ssl->no_wait_shutdown = 1; 706 c->ssl->no_wait_shutdown = 1;
707 707
708 #if (NGX_HTTP_SPDY && defined TLSEXT_TYPE_next_proto_neg) 708 #if (NGX_HTTP_SPDY \
709 && (defined TLSEXT_TYPE_application_layer_protocol_negotiation \
710 || defined TLSEXT_TYPE_next_proto_neg))
709 { 711 {
710 unsigned int len; 712 unsigned int len;
711 const unsigned char *data; 713 const unsigned char *data;
712 static const ngx_str_t spdy = ngx_string(NGX_SPDY_NPN_NEGOTIATED); 714 static const ngx_str_t spdy = ngx_string(NGX_SPDY_NPN_NEGOTIATED);
713 715
714 SSL_get0_next_proto_negotiated(c->ssl->connection, &data, &len); 716 len = 0;
717
718 #ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
719 SSL_get0_alpn_selected(c->ssl->connection, &data, &len);
720 #endif
721
722 #ifdef TLSEXT_TYPE_next_proto_neg
723 if (len == 0) {
724 SSL_get0_next_proto_negotiated(c->ssl->connection, &data, &len);
725 }
726 #endif
715 727
716 if (len == spdy.len && ngx_strncmp(data, spdy.data, spdy.len) == 0) { 728 if (len == spdy.len && ngx_strncmp(data, spdy.data, spdy.len) == 0) {
717 ngx_http_spdy_init(c->read); 729 ngx_http_spdy_init(c->read);
718 return; 730 return;
719 } 731 }