comparison src/stream/ngx_stream_handler.c @ 8872:2706d27d2c76 quic

Stream: fixed segfault when using SSL certificates with variables. Similar to the previous change, a segmentation fault occurres when evaluating SSL certificates on a QUIC connection due to an uninitialized stream session. The fix is to adjust initializing the QUIC part of a connection until after it has session and variables initialized. Similarly, this appends logging error context for QUIC connections: - client 127.0.0.1:54749 connected to 127.0.0.1:8880 while handling frames - quic client timed out (60: Operation timed out) while handling quic input
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 29 Sep 2021 15:06:28 +0300
parents e96c20b6f655
children 113e2438dbd4
comparison
equal deleted inserted replaced
8871:74b43926b470 8872:2706d27d2c76
113 addr_conf = &addr[0].conf; 113 addr_conf = &addr[0].conf;
114 break; 114 break;
115 } 115 }
116 } 116 }
117 117
118 #if (NGX_STREAM_QUIC)
119
120 if (addr_conf->quic) {
121 ngx_quic_conf_t *qcf;
122
123 if (c->quic == NULL) {
124 c->log->connection = c->number;
125
126 qcf = ngx_stream_get_module_srv_conf(addr_conf->ctx,
127 ngx_stream_quic_module);
128 ngx_quic_run(c, qcf);
129 return;
130 }
131 }
132
133 #endif
134
135 s = ngx_pcalloc(c->pool, sizeof(ngx_stream_session_t)); 118 s = ngx_pcalloc(c->pool, sizeof(ngx_stream_session_t));
136 if (s == NULL) { 119 if (s == NULL) {
137 ngx_stream_close_connection(c); 120 ngx_stream_close_connection(c);
138 return; 121 return;
139 } 122 }
191 } 174 }
192 175
193 tp = ngx_timeofday(); 176 tp = ngx_timeofday();
194 s->start_sec = tp->sec; 177 s->start_sec = tp->sec;
195 s->start_msec = tp->msec; 178 s->start_msec = tp->msec;
179
180 #if (NGX_STREAM_QUIC)
181
182 if (addr_conf->quic) {
183 ngx_quic_conf_t *qcf;
184
185 if (c->quic == NULL) {
186 qcf = ngx_stream_get_module_srv_conf(addr_conf->ctx,
187 ngx_stream_quic_module);
188 ngx_quic_run(c, qcf);
189 return;
190 }
191 }
192
193 #endif
196 194
197 rev = c->read; 195 rev = c->read;
198 rev->handler = ngx_stream_session_handler; 196 rev->handler = ngx_stream_session_handler;
199 197
200 if (addr_conf->proxy_protocol) { 198 if (addr_conf->proxy_protocol) {