comparison src/http/ngx_http_request.c @ 2195:a953f73273ee

server_name "" support
author Igor Sysoev <igor@sysoev.ru>
date Thu, 21 Aug 2008 12:56:10 +0000
parents 1d37b13ef004
children 5398f47082f0
comparison
equal deleted inserted replaced
2194:d3f833da6b65 2195:a953f73273ee
569 #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME 569 #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
570 570
571 int 571 int
572 ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg) 572 ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg)
573 { 573 {
574 size_t len;
574 const char *servername; 575 const char *servername;
575 ngx_connection_t *c; 576 ngx_connection_t *c;
576 ngx_http_request_t *r; 577 ngx_http_request_t *r;
577 ngx_http_ssl_srv_conf_t *sscf; 578 ngx_http_ssl_srv_conf_t *sscf;
578 579
585 c = ngx_ssl_get_connection(ssl_conn); 586 c = ngx_ssl_get_connection(ssl_conn);
586 587
587 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, 588 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
588 "SSL server name: \"%s\"", servername); 589 "SSL server name: \"%s\"", servername);
589 590
591 len = ngx_strlen(servername);
592
593 if (len == 0) {
594 return SSL_TLSEXT_ERR_NOACK;
595 }
596
590 r = c->data; 597 r = c->data;
591 598
592 if (ngx_http_find_virtual_server(r, (u_char *) servername, 599 if (ngx_http_find_virtual_server(r, (u_char *) servername, len) != NGX_OK) {
593 ngx_strlen(servername))
594 != NGX_OK)
595 {
596 return SSL_TLSEXT_ERR_NOACK; 600 return SSL_TLSEXT_ERR_NOACK;
597 } 601 }
598 602
599 sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module); 603 sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module);
600 604
1557 ngx_uint_t hash; 1561 ngx_uint_t hash;
1558 ngx_http_core_loc_conf_t *clcf; 1562 ngx_http_core_loc_conf_t *clcf;
1559 ngx_http_core_srv_conf_t *cscf; 1563 ngx_http_core_srv_conf_t *cscf;
1560 u_char buf[32]; 1564 u_char buf[32];
1561 1565
1562 if (len == 0 || r->virtual_names == NULL) { 1566 if (r->virtual_names == NULL) {
1563 return NGX_DECLINED; 1567 return NGX_DECLINED;
1564 } 1568 }
1565 1569
1566 if (len <= 32) { 1570 if (len <= 32) {
1567 server = buf; 1571 server = buf;