Klaus Demo nginx / b29426d
server_name "" support Igor Sysoev 12 years ago
3 changed file(s) with 32 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
219219 }
220220 }
221221
222 if (len == 0) {
223 return NULL;
224 }
225
222226 if (hash->wc_head && hash->wc_head->hash.buckets) {
223227 value = ngx_hash_find_wc_head(hash->wc_head, name, len);
224228
30933093
30943094 ch = value[1].data[0];
30953095
3096 if (cscf->server_name.data == NULL && value[1].len) {
3097 name = value[1];
3098
3099 if (ch == '.') {
3100 name.len--;
3101 name.data++;
3102 }
3103
3104 cscf->server_name.len = name.len;
3105 cscf->server_name.data = ngx_pstrdup(cf->pool, &name);
3106 if (cscf->server_name.data == NULL) {
3096 if (cscf->server_name.data == NULL) {
3097 if (value[1].len) {
3098 name = value[1];
3099
3100 if (ch == '.') {
3101 name.len--;
3102 name.data++;
3103 }
3104
3105 cscf->server_name.len = name.len;
3106 cscf->server_name.data = ngx_pstrdup(cf->pool, &name);
3107 if (cscf->server_name.data == NULL) {
3108 return NGX_CONF_ERROR;
3109 }
3110
3111 } else {
3112 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
3113 "the first server name must not be empty");
31073114 return NGX_CONF_ERROR;
31083115 }
31093116 }
31123119
31133120 ch = value[i].data[0];
31143121
3115 if (value[i].len == 0
3116 || (ch == '*' && (value[i].len < 3 || value[i].data[1] != '.'))
3122 if ((ch == '*' && (value[i].len < 3 || value[i].data[1] != '.'))
31173123 || (ch == '.' && value[i].len < 2))
31183124 {
31193125 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
570570 int
571571 ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg)
572572 {
573 size_t len;
573574 const char *servername;
574575 ngx_connection_t *c;
575576 ngx_http_request_t *r;
586587 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
587588 "SSL server name: \"%s\"", servername);
588589
590 len = ngx_strlen(servername);
591
592 if (len == 0) {
593 return SSL_TLSEXT_ERR_NOACK;
594 }
595
589596 r = c->data;
590597
591 if (ngx_http_find_virtual_server(r, (u_char *) servername,
592 ngx_strlen(servername))
593 != NGX_OK)
594 {
598 if (ngx_http_find_virtual_server(r, (u_char *) servername, len) != NGX_OK) {
595599 return SSL_TLSEXT_ERR_NOACK;
596600 }
597601
15581562 ngx_http_core_srv_conf_t *cscf;
15591563 u_char buf[32];
15601564
1561 if (len == 0 || r->virtual_names == NULL) {
1565 if (r->virtual_names == NULL) {
15621566 return NGX_DECLINED;
15631567 }
15641568