Ticket #384: trailing-dot-in-server_name.patch

File trailing-dot-in-server_name.patch, 684 bytes (added by Leslie Zhai, 12 years ago)
  • src/http/ngx_http_core_module.c

    diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
    index 4071b61..29b400d 100644
    a b ngx_http_core_server_name(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)  
    43434343        ch = value[i].data[0];
    43444344
    43454345        if ((ch == '*' && (value[i].len < 3 || value[i].data[1] != '.'))
    4346             || (ch == '.' && value[i].len < 2))
     4346            || (ch == '.' && value[i].len < 2)
     4347            || value[i].data[value[i].len - 1] == '.')
    43474348        {
    43484349            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
    43494350                               "server name \"%V\" is invalid", &value[i]);