ngx_http_core_srv_conf_t *cscf;
if (ngx_http_v3_init_session(c) != NGX_OK) {
- ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_INTERNAL_ERROR,
- "internal error");
ngx_http_close_connection(c);
return;
}
h3c->goaway = 1;
if (ngx_http_v3_send_goaway(c, (n + 1) << 2) != NGX_OK) {
- ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_INTERNAL_ERROR,
- "goaway error");
ngx_http_close_connection(c);
return;
}
rc = ngx_http_v3_parse_headers(c, st, b);
if (rc > 0) {
- ngx_http_v3_finalize_connection(c, rc,
- "could not parse request headers");
+ ngx_quic_reset_stream(c, rc);
+ ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+ "client sent invalid header");
ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
break;
}
if (rc == NGX_ERROR) {
- ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_INTERNAL_ERROR,
- "internal error");
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
break;
}
}
if (rc > 0) {
- ngx_http_v3_finalize_connection(r->connection, rc,
- "client sent invalid body");
+ ngx_quic_reset_stream(r->connection, rc);
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"client sent invalid body");
return NGX_HTTP_BAD_REQUEST;
}
if (rc == NGX_ERROR) {
- ngx_http_v3_finalize_connection(r->connection,
- NGX_HTTP_V3_ERR_INTERNAL_ERROR,
- "internal error");
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
sc = ngx_quic_open_stream(c, 0);
if (sc == NULL) {
- return NULL;
+ goto failed;
}
p = buf;
failed:
- ngx_http_v3_close_uni_stream(sc);
+ ngx_log_error(NGX_LOG_ERR, c->log, 0, "failed to create push stream");
+
+ ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_STREAM_CREATION_ERROR,
+ "failed to create push stream");
+ if (sc) {
+ ngx_http_v3_close_uni_stream(sc);
+ }
return NULL;
}
sc = ngx_quic_open_stream(c, 0);
if (sc == NULL) {
- return NULL;
+ goto failed;
}
sc->quic->cancelable = 1;
failed:
- ngx_http_v3_close_uni_stream(sc);
+ ngx_log_error(NGX_LOG_ERR, c->log, 0, "failed to create server stream");
+
+ ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_STREAM_CREATION_ERROR,
+ "failed to create server stream");
+ if (sc) {
+ ngx_http_v3_close_uni_stream(sc);
+ }
return NULL;
}
cc = ngx_http_v3_get_uni_stream(c, NGX_HTTP_V3_STREAM_CONTROL);
if (cc == NULL) {
- return NGX_DECLINED;
+ return NGX_ERROR;
}
h3scf = ngx_http_v3_get_module_srv_conf(c, ngx_http_v3_module);
failed:
+ ngx_log_error(NGX_LOG_ERR, c->log, 0, "failed to send settings");
+
+ ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_EXCESSIVE_LOAD,
+ "failed to send settings");
ngx_http_v3_close_uni_stream(cc);
return NGX_ERROR;
cc = ngx_http_v3_get_uni_stream(c, NGX_HTTP_V3_STREAM_CONTROL);
if (cc == NULL) {
- return NGX_DECLINED;
+ return NGX_ERROR;
}
n = ngx_http_v3_encode_varlen_int(NULL, id);
failed:
+ ngx_log_error(NGX_LOG_ERR, c->log, 0, "failed to send goaway");
+
+ ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_EXCESSIVE_LOAD,
+ "failed to send goaway");
ngx_http_v3_close_uni_stream(cc);
return NGX_ERROR;
ngx_http_v3_session_t *h3c;
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http3 client ack section %ui", stream_id);
+ "http3 send section acknowledgement %ui", stream_id);
dc = ngx_http_v3_get_uni_stream(c, NGX_HTTP_V3_STREAM_DECODER);
if (dc == NULL) {
h3c->total_bytes += n;
if (dc->send(dc, buf, n) != (ssize_t) n) {
- ngx_http_v3_close_uni_stream(dc);
- return NGX_ERROR;
+ goto failed;
}
return NGX_OK;
+
+failed:
+
+ ngx_log_error(NGX_LOG_ERR, c->log, 0,
+ "failed to send section acknowledgement");
+
+ ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_EXCESSIVE_LOAD,
+ "failed to send section acknowledgement");
+ ngx_http_v3_close_uni_stream(dc);
+
+ return NGX_ERROR;
}
ngx_http_v3_session_t *h3c;
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http3 client cancel stream %ui", stream_id);
+ "http3 send stream cancellation %ui", stream_id);
dc = ngx_http_v3_get_uni_stream(c, NGX_HTTP_V3_STREAM_DECODER);
if (dc == NULL) {
h3c->total_bytes += n;
if (dc->send(dc, buf, n) != (ssize_t) n) {
- ngx_http_v3_close_uni_stream(dc);
- return NGX_ERROR;
+ goto failed;
}
return NGX_OK;
+
+failed:
+
+ ngx_log_error(NGX_LOG_ERR, c->log, 0, "failed to send stream cancellation");
+
+ ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_EXCESSIVE_LOAD,
+ "failed to send stream cancellation");
+ ngx_http_v3_close_uni_stream(dc);
+
+ return NGX_ERROR;
}
ngx_http_v3_session_t *h3c;
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http3 client increment insert count %ui", inc);
+ "http3 send insert count increment %ui", inc);
dc = ngx_http_v3_get_uni_stream(c, NGX_HTTP_V3_STREAM_DECODER);
if (dc == NULL) {
h3c->total_bytes += n;
if (dc->send(dc, buf, n) != (ssize_t) n) {
- ngx_http_v3_close_uni_stream(dc);
- return NGX_ERROR;
+ goto failed;
}
return NGX_OK;
+
+failed:
+
+ ngx_log_error(NGX_LOG_ERR, c->log, 0,
+ "failed to send insert count increment");
+
+ ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_EXCESSIVE_LOAD,
+ "failed to send insert count increment");
+ ngx_http_v3_close_uni_stream(dc);
+
+ return NGX_ERROR;
}