Mercurial > hg > nginx
comparison src/http/modules/ngx_http_ssl_module.c @ 611:3f8a2132b93d release-0.3.27
nginx-0.3.27-RELEASE import
*) Change: the "variables_hash_max_size" and
"variables_hash_bucket_size" directives.
*) Feature: the $body_bytes_sent variable can be used not only in the
"log_format" directive.
*) Feature: the $ssl_protocol and $ssl_cipher variables.
*) Feature: the cache line size detection for widespread CPUs at start
time.
*) Feature: now the "accept_mutex" directive is supported using
fcntl(2) on platforms different from i386, amd64, sparc64, and ppc.
*) Feature: the "lock_file" directive and the --with-lock-path=PATH
autoconfiguration directive.
*) Bugfix: if the HTTPS protocol was used in the "proxy_pass" directive
then the requests with the body was not transferred.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 08 Feb 2006 15:33:12 +0000 |
parents | 869b6444d234 |
children | e60fe4cf1d4e |
comparison
equal
deleted
inserted
replaced
610:200d628b47dd | 611:3f8a2132b93d |
---|---|
7 #include <ngx_config.h> | 7 #include <ngx_config.h> |
8 #include <ngx_core.h> | 8 #include <ngx_core.h> |
9 #include <ngx_http.h> | 9 #include <ngx_http.h> |
10 | 10 |
11 | 11 |
12 typedef u_char *(*ngx_ssl_variable_handler_pt)(ngx_connection_t *); | |
13 | |
14 | |
12 #define NGX_DEFLAUT_CERTIFICATE "cert.pem" | 15 #define NGX_DEFLAUT_CERTIFICATE "cert.pem" |
13 #define NGX_DEFLAUT_CERTIFICATE_KEY "cert.pem" | 16 #define NGX_DEFLAUT_CERTIFICATE_KEY "cert.pem" |
14 #define NGX_DEFLAUT_CIPHERS "ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP" | 17 #define NGX_DEFLAUT_CIPHERS "ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP" |
15 | 18 |
16 | 19 |
20 static ngx_int_t ngx_http_ssl_variable(ngx_http_request_t *r, | |
21 ngx_http_variable_value_t *v, uintptr_t data); | |
22 | |
23 static ngx_int_t ngx_http_ssl_add_variables(ngx_conf_t *cf); | |
17 static void *ngx_http_ssl_create_srv_conf(ngx_conf_t *cf); | 24 static void *ngx_http_ssl_create_srv_conf(ngx_conf_t *cf); |
18 static char *ngx_http_ssl_merge_srv_conf(ngx_conf_t *cf, | 25 static char *ngx_http_ssl_merge_srv_conf(ngx_conf_t *cf, |
19 void *parent, void *child); | 26 void *parent, void *child); |
20 | 27 |
21 #if !defined (SSL_OP_CIPHER_SERVER_PREFERENCE) | 28 #if !defined (SSL_OP_CIPHER_SERVER_PREFERENCE) |
95 ngx_null_command | 102 ngx_null_command |
96 }; | 103 }; |
97 | 104 |
98 | 105 |
99 static ngx_http_module_t ngx_http_ssl_module_ctx = { | 106 static ngx_http_module_t ngx_http_ssl_module_ctx = { |
100 NULL, /* preconfiguration */ | 107 ngx_http_ssl_add_variables, /* preconfiguration */ |
101 NULL, /* postconfiguration */ | 108 NULL, /* postconfiguration */ |
102 | 109 |
103 NULL, /* create main configuration */ | 110 NULL, /* create main configuration */ |
104 NULL, /* init main configuration */ | 111 NULL, /* init main configuration */ |
105 | 112 |
125 NULL, /* exit master */ | 132 NULL, /* exit master */ |
126 NGX_MODULE_V1_PADDING | 133 NGX_MODULE_V1_PADDING |
127 }; | 134 }; |
128 | 135 |
129 | 136 |
137 static ngx_http_variable_t ngx_http_ssl_vars[] = { | |
138 | |
139 { ngx_string("ssl_protocol"), ngx_http_ssl_variable, | |
140 (uintptr_t) ngx_ssl_get_protocol, NGX_HTTP_VAR_CHANGABLE, 0 }, | |
141 | |
142 { ngx_string("ssl_cipher"), ngx_http_ssl_variable, | |
143 (uintptr_t) ngx_ssl_get_cipher_name, NGX_HTTP_VAR_CHANGABLE, 0 }, | |
144 | |
145 { ngx_null_string, NULL, 0, 0, 0 } | |
146 }; | |
147 | |
148 | |
130 static u_char ngx_http_session_id_ctx[] = "HTTP"; | 149 static u_char ngx_http_session_id_ctx[] = "HTTP"; |
150 | |
151 | |
152 static ngx_int_t | |
153 ngx_http_ssl_variable(ngx_http_request_t *r, | |
154 ngx_http_variable_value_t *v, uintptr_t data) | |
155 { | |
156 ngx_ssl_variable_handler_pt handler = (ngx_ssl_variable_handler_pt) data; | |
157 | |
158 size_t len; | |
159 u_char *name; | |
160 | |
161 if (r->connection->ssl) { | |
162 | |
163 name = handler(r->connection); | |
164 | |
165 for (len = 0; name[len]; len++) { /* void */ } | |
166 | |
167 v->len = len; | |
168 v->valid = 1; | |
169 v->no_cachable = 0; | |
170 v->not_found = 0; | |
171 v->data = name; | |
172 | |
173 return NGX_OK; | |
174 } | |
175 | |
176 v->not_found = 1; | |
177 | |
178 return NGX_OK; | |
179 } | |
180 | |
181 | |
182 static ngx_int_t | |
183 ngx_http_ssl_add_variables(ngx_conf_t *cf) | |
184 { | |
185 ngx_http_variable_t *var, *v; | |
186 | |
187 for (v = ngx_http_ssl_vars; v->name.len; v++) { | |
188 var = ngx_http_add_variable(cf, &v->name, v->flags); | |
189 if (var == NULL) { | |
190 return NGX_ERROR; | |
191 } | |
192 | |
193 var->handler = v->handler; | |
194 var->data = v->data; | |
195 } | |
196 | |
197 return NGX_OK; | |
198 } | |
131 | 199 |
132 | 200 |
133 static void * | 201 static void * |
134 ngx_http_ssl_create_srv_conf(ngx_conf_t *cf) | 202 ngx_http_ssl_create_srv_conf(ngx_conf_t *cf) |
135 { | 203 { |