comparison src/http/ngx_http_request.c @ 8460:72f9ff4e0a88 quic

HTTP/3: close QUIC connection with HTTP/QPACK errors when needed. Previously errors led only to closing streams. To simplify closing QUIC connection from a QUIC stream context, new macro ngx_http_v3_finalize_connection() is introduced. It calls ngx_quic_finalize_connection() for the parent connection.
author Roman Arutyunyan <arut@nginx.com>
date Thu, 02 Jul 2020 16:47:51 +0300
parents c9538aef3211
children b3c07aa021f6
comparison
equal deleted inserted replaced
8459:1ed698947172 8460:72f9ff4e0a88
414 414
415 static void 415 static void
416 ngx_http_quic_stream_handler(ngx_connection_t *c) 416 ngx_http_quic_stream_handler(ngx_connection_t *c)
417 { 417 {
418 ngx_event_t *rev; 418 ngx_event_t *rev;
419 ngx_connection_t *pc;
420 ngx_http_log_ctx_t *ctx; 419 ngx_http_log_ctx_t *ctx;
421 ngx_http_connection_t *hc; 420 ngx_http_connection_t *hc;
422 ngx_http_v3_connection_t *h3c; 421 ngx_http_v3_connection_t *h3c;
423 422
424 pc = c->qs->parent; 423 h3c = c->qs->parent->data;
425 h3c = pc->data;
426 424
427 if (!h3c->settings_sent) { 425 if (!h3c->settings_sent) {
428 h3c->settings_sent = 1; 426 h3c->settings_sent = 1;
429 427
430 /* TODO close QUIC connection on error */ 428 if (ngx_http_v3_send_settings(c) != NGX_OK) {
431 (void) ngx_http_v3_send_settings(c); 429 ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_INTERNAL_ERROR,
430 "could not send settings");
431 ngx_http_close_connection(c);
432 return;
433 }
432 } 434 }
433 435
434 if (c->qs->id & NGX_QUIC_STREAM_UNIDIRECTIONAL) { 436 if (c->qs->id & NGX_QUIC_STREAM_UNIDIRECTIONAL) {
435 ngx_http_v3_handle_client_uni_stream(c); 437 ngx_http_v3_handle_client_uni_stream(c);
436 return; 438 return;