Ticket #37: patch-nginx-ssl-config.txt

File patch-nginx-ssl-config.txt, 1.1 KB (added by Maxim Dounin, 15 years ago)
Line 
1# HG changeset patch
2# User Maxim Dounin <mdounin@mdounin.ru>
3# Date 1319127783 -14400
4# Node ID 05c5674bee96db3fcf5d3ed0f73f58afc6d7f68a
5# Parent 84010faa17f890a2c858bf6ac23e281679eb15f7
6Fixed segfault on configuration testing with ssl (ticket #37).
7
8The following config caused segmentation fault due to conf->file not
9being properly set if "ssl on" was inherited from the http level:
10
11http {
12 ssl on;
13 server {
14 }
15}
16
17diff --git a/src/http/modules/ngx_http_ssl_module.c b/src/http/modules/ngx_http_ssl_module.c
18--- a/src/http/modules/ngx_http_ssl_module.c
19+++ b/src/http/modules/ngx_http_ssl_module.c
20@@ -346,7 +346,16 @@ ngx_http_ssl_merge_srv_conf(ngx_conf_t *
21
22 ngx_pool_cleanup_t *cln;
23
24- ngx_conf_merge_value(conf->enable, prev->enable, 0);
25+ if (conf->enable == NGX_CONF_UNSET) {
26+ if (prev->enable == NGX_CONF_UNSET) {
27+ conf->enable = 0;
28+
29+ } else {
30+ conf->enable = prev->enable;
31+ conf->file = prev->file;
32+ conf->line = prev->line;
33+ }
34+ }
35
36 ngx_conf_merge_value(conf->session_timeout,
37 prev->session_timeout, 300);