Mercurial > hg > nginx-tests
comparison ssl.t @ 1655:666d54ab5036
Tests: ssl_session_timeout fixes.
The directive is moved to a distinct server block to avoid unexpected
expirations. Actually provide SSL session (broken in c6f27bcdd9d9).
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 18 Feb 2021 13:52:47 +0300 |
parents | 2f00ed2e0d1a |
children | 0d1cec688111 |
comparison
equal
deleted
inserted
replaced
1654:341506267e16 | 1655:666d54ab5036 |
---|---|
101 | 101 |
102 # Special case for enabled "ssl" directive. | 102 # Special case for enabled "ssl" directive. |
103 | 103 |
104 ssl on; | 104 ssl on; |
105 ssl_session_cache builtin; | 105 ssl_session_cache builtin; |
106 | |
107 location / { | |
108 return 200 "body $ssl_session_reused"; | |
109 } | |
110 } | |
111 | |
112 server { | |
113 listen 127.0.0.1:8082 ssl; | |
114 server_name localhost; | |
115 | |
116 ssl_session_cache builtin:1000; | |
117 | |
118 location / { | |
119 return 200 "body $ssl_session_reused"; | |
120 } | |
121 } | |
122 | |
123 server { | |
124 listen 127.0.0.1:8083 ssl; | |
125 server_name localhost; | |
126 | |
127 ssl_session_cache none; | |
128 | |
129 location / { | |
130 return 200 "body $ssl_session_reused"; | |
131 } | |
132 } | |
133 | |
134 server { | |
135 listen 127.0.0.1:8084 ssl; | |
136 server_name localhost; | |
137 | |
138 ssl_session_cache off; | |
139 | |
140 location / { | |
141 return 200 "body $ssl_session_reused"; | |
142 } | |
143 } | |
144 | |
145 server { | |
146 listen 127.0.0.1:8086 ssl; | |
147 server_name localhost; | |
148 | |
149 ssl_session_cache shared:SSL:1m; | |
106 ssl_session_timeout 1; | 150 ssl_session_timeout 1; |
107 | |
108 location / { | |
109 return 200 "body $ssl_session_reused"; | |
110 } | |
111 } | |
112 | |
113 server { | |
114 listen 127.0.0.1:8082 ssl; | |
115 server_name localhost; | |
116 | |
117 ssl_session_cache builtin:1000; | |
118 | |
119 location / { | |
120 return 200 "body $ssl_session_reused"; | |
121 } | |
122 } | |
123 | |
124 server { | |
125 listen 127.0.0.1:8083 ssl; | |
126 server_name localhost; | |
127 | |
128 ssl_session_cache none; | |
129 | |
130 location / { | |
131 return 200 "body $ssl_session_reused"; | |
132 } | |
133 } | |
134 | |
135 server { | |
136 listen 127.0.0.1:8084 ssl; | |
137 server_name localhost; | |
138 | |
139 ssl_session_cache off; | |
140 | 151 |
141 location / { | 152 location / { |
142 return 200 "body $ssl_session_reused"; | 153 return 200 "body $ssl_session_reused"; |
143 } | 154 } |
144 } | 155 } |
254 | 265 |
255 $s->close(); | 266 $s->close(); |
256 | 267 |
257 # session timeout | 268 # session timeout |
258 | 269 |
270 $ctx = get_ssl_context(); | |
271 | |
272 get('/', 8086, $ctx); | |
259 select undef, undef, undef, 2.1; | 273 select undef, undef, undef, 2.1; |
260 | 274 |
261 like(get('/', 8081), qr/^body \.$/m, 'session timeout'); | 275 like(get('/', 8086, $ctx), qr/^body \.$/m, 'session timeout'); |
262 | 276 |
263 # embedded variables | 277 # embedded variables |
264 | 278 |
265 like(get('/id', 8085), qr/^body \w{64}$/m, 'session id'); | 279 like(get('/id', 8085), qr/^body \w{64}$/m, 'session id'); |
266 unlike(http_get('/id'), qr/body \w/, 'session id no ssl'); | 280 unlike(http_get('/id'), qr/body \w/, 'session id no ssl'); |