mirror of
https://github.com/nginx/nginx.git
synced 2025-06-22 13:51:12 +08:00
HTTP/3: simplified handling return codes from parse functions.
This commit is contained in:
parent
ac9c1dcad8
commit
3db00b4da7
@ -197,11 +197,6 @@ ngx_http_v3_parse_headers(ngx_connection_t *c, ngx_http_v3_parse_headers_t *st,
|
|||||||
}
|
}
|
||||||
|
|
||||||
rc = ngx_http_v3_parse_header_block_prefix(c, &st->prefix, ch);
|
rc = ngx_http_v3_parse_header_block_prefix(c, &st->prefix, ch);
|
||||||
|
|
||||||
if (rc == NGX_AGAIN) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rc != NGX_DONE) {
|
if (rc != NGX_DONE) {
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -228,14 +223,9 @@ ngx_http_v3_parse_headers(ngx_connection_t *c, ngx_http_v3_parse_headers_t *st,
|
|||||||
|
|
||||||
rc = ngx_http_v3_parse_header_rep(c, &st->header_rep, st->prefix.base,
|
rc = ngx_http_v3_parse_header_rep(c, &st->header_rep, st->prefix.base,
|
||||||
ch);
|
ch);
|
||||||
st->length--;
|
|
||||||
|
|
||||||
if (rc == NGX_AGAIN) {
|
if (--st->length == 0 && rc == NGX_AGAIN) {
|
||||||
if (st->length == 0) {
|
return NGX_HTTP_V3_ERR_FRAME_ERROR;
|
||||||
return NGX_HTTP_V3_ERR_FRAME_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rc != NGX_DONE) {
|
if (rc != NGX_DONE) {
|
||||||
@ -1018,14 +1008,8 @@ ngx_http_v3_parse_control(ngx_connection_t *c, void *data, u_char ch)
|
|||||||
|
|
||||||
rc = ngx_http_v3_parse_settings(c, &st->settings, ch);
|
rc = ngx_http_v3_parse_settings(c, &st->settings, ch);
|
||||||
|
|
||||||
st->length--;
|
if (--st->length == 0 && rc == NGX_AGAIN) {
|
||||||
|
return NGX_HTTP_V3_ERR_SETTINGS_ERROR;
|
||||||
if (rc == NGX_AGAIN) {
|
|
||||||
if (st->length == 0) {
|
|
||||||
return NGX_HTTP_V3_ERR_SETTINGS_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rc != NGX_DONE) {
|
if (rc != NGX_DONE) {
|
||||||
@ -1167,11 +1151,6 @@ ngx_http_v3_parse_encoder(ngx_connection_t *c, void *data, u_char ch)
|
|||||||
case sw_inr:
|
case sw_inr:
|
||||||
|
|
||||||
rc = ngx_http_v3_parse_header_inr(c, &st->header, ch);
|
rc = ngx_http_v3_parse_header_inr(c, &st->header, ch);
|
||||||
|
|
||||||
if (rc == NGX_AGAIN) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rc != NGX_DONE) {
|
if (rc != NGX_DONE) {
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -1181,11 +1160,6 @@ ngx_http_v3_parse_encoder(ngx_connection_t *c, void *data, u_char ch)
|
|||||||
case sw_iwnr:
|
case sw_iwnr:
|
||||||
|
|
||||||
rc = ngx_http_v3_parse_header_iwnr(c, &st->header, ch);
|
rc = ngx_http_v3_parse_header_iwnr(c, &st->header, ch);
|
||||||
|
|
||||||
if (rc == NGX_AGAIN) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rc != NGX_DONE) {
|
if (rc != NGX_DONE) {
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user