Mercurial > hg > nginx-quic
comparison src/http/v3/ngx_http_v3_parse.c @ 7961:4fd709540daf quic
HTTP/3: put ngx_http_v3_parse_varlen_int() return code in variable.
This makes calling this function similar to other parse functions.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Fri, 03 Jul 2020 12:07:43 +0300 |
parents | 5611bbb852ce |
children | e02250b55b17 |
comparison
equal
deleted
inserted
replaced
7960:5611bbb852ce | 7961:4fd709540daf |
---|---|
175 st->state = sw_length; | 175 st->state = sw_length; |
176 break; | 176 break; |
177 | 177 |
178 case sw_length: | 178 case sw_length: |
179 | 179 |
180 if (ngx_http_v3_parse_varlen_int(c, &st->vlint, ch) != NGX_DONE) { | 180 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, ch); |
181 break; | 181 if (rc != NGX_DONE) { |
182 return rc; | |
182 } | 183 } |
183 | 184 |
184 st->length = st->vlint.value; | 185 st->length = st->vlint.value; |
185 | 186 |
186 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | 187 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |
958 /* fall through */ | 959 /* fall through */ |
959 | 960 |
960 case sw_first_type: | 961 case sw_first_type: |
961 case sw_type: | 962 case sw_type: |
962 | 963 |
963 if (ngx_http_v3_parse_varlen_int(c, &st->vlint, ch) != NGX_DONE) { | 964 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, ch); |
964 break; | 965 if (rc != NGX_DONE) { |
966 return rc; | |
965 } | 967 } |
966 | 968 |
967 st->type = st->vlint.value; | 969 st->type = st->vlint.value; |
968 | 970 |
969 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | 971 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |
978 st->state = sw_length; | 980 st->state = sw_length; |
979 break; | 981 break; |
980 | 982 |
981 case sw_length: | 983 case sw_length: |
982 | 984 |
983 if (ngx_http_v3_parse_varlen_int(c, &st->vlint, ch) != NGX_DONE) { | 985 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, ch); |
984 break; | 986 if (rc != NGX_DONE) { |
987 return rc; | |
985 } | 988 } |
986 | 989 |
987 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | 990 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |
988 "http3 parse frame len:%uL", st->vlint.value); | 991 "http3 parse frame len:%uL", st->vlint.value); |
989 | 992 |
1035 | 1038 |
1036 break; | 1039 break; |
1037 | 1040 |
1038 case sw_max_push_id: | 1041 case sw_max_push_id: |
1039 | 1042 |
1040 if (ngx_http_v3_parse_varlen_int(c, &st->vlint, ch) != NGX_DONE) { | 1043 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, ch); |
1041 break; | 1044 if (rc != NGX_DONE) { |
1045 return rc; | |
1042 } | 1046 } |
1043 | 1047 |
1044 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | 1048 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |
1045 "http3 parse MAX_PUSH_ID:%uL", st->vlint.value); | 1049 "http3 parse MAX_PUSH_ID:%uL", st->vlint.value); |
1046 | 1050 |
1062 | 1066 |
1063 ngx_int_t | 1067 ngx_int_t |
1064 ngx_http_v3_parse_settings(ngx_connection_t *c, | 1068 ngx_http_v3_parse_settings(ngx_connection_t *c, |
1065 ngx_http_v3_parse_settings_t *st, u_char ch) | 1069 ngx_http_v3_parse_settings_t *st, u_char ch) |
1066 { | 1070 { |
1071 ngx_int_t rc; | |
1067 enum { | 1072 enum { |
1068 sw_start = 0, | 1073 sw_start = 0, |
1069 sw_id, | 1074 sw_id, |
1070 sw_value | 1075 sw_value |
1071 }; | 1076 }; |
1080 | 1085 |
1081 /* fall through */ | 1086 /* fall through */ |
1082 | 1087 |
1083 case sw_id: | 1088 case sw_id: |
1084 | 1089 |
1085 if (ngx_http_v3_parse_varlen_int(c, &st->vlint, ch) != NGX_DONE) { | 1090 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, ch); |
1086 break; | 1091 if (rc != NGX_DONE) { |
1092 return rc; | |
1087 } | 1093 } |
1088 | 1094 |
1089 st->id = st->vlint.value; | 1095 st->id = st->vlint.value; |
1090 st->state = sw_value; | 1096 st->state = sw_value; |
1091 break; | 1097 break; |
1092 | 1098 |
1093 case sw_value: | 1099 case sw_value: |
1094 | 1100 |
1095 if (ngx_http_v3_parse_varlen_int(c, &st->vlint, ch) != NGX_DONE) { | 1101 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, ch); |
1096 break; | 1102 if (rc != NGX_DONE) { |
1103 return rc; | |
1097 } | 1104 } |
1098 | 1105 |
1099 if (ngx_http_v3_set_param(c, st->id, st->vlint.value) != NGX_OK) { | 1106 if (ngx_http_v3_set_param(c, st->id, st->vlint.value) != NGX_OK) { |
1100 return NGX_HTTP_V3_ERR_SETTINGS_ERROR; | 1107 return NGX_HTTP_V3_ERR_SETTINGS_ERROR; |
1101 } | 1108 } |
1510 | 1517 |
1511 ngx_int_t | 1518 ngx_int_t |
1512 ngx_http_v3_parse_data(ngx_connection_t *c, ngx_http_v3_parse_data_t *st, | 1519 ngx_http_v3_parse_data(ngx_connection_t *c, ngx_http_v3_parse_data_t *st, |
1513 u_char ch) | 1520 u_char ch) |
1514 { | 1521 { |
1522 ngx_int_t rc; | |
1515 enum { | 1523 enum { |
1516 sw_start = 0, | 1524 sw_start = 0, |
1517 sw_type, | 1525 sw_type, |
1518 sw_length | 1526 sw_length |
1519 }; | 1527 }; |
1528 | 1536 |
1529 /* fall through */ | 1537 /* fall through */ |
1530 | 1538 |
1531 case sw_type: | 1539 case sw_type: |
1532 | 1540 |
1533 if (ngx_http_v3_parse_varlen_int(c, &st->vlint, ch) != NGX_DONE) { | 1541 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, ch); |
1534 break; | 1542 if (rc != NGX_DONE) { |
1543 return rc; | |
1535 } | 1544 } |
1536 | 1545 |
1537 if (st->vlint.value != NGX_HTTP_V3_FRAME_DATA) { | 1546 if (st->vlint.value != NGX_HTTP_V3_FRAME_DATA) { |
1538 return NGX_HTTP_V3_ERR_FRAME_UNEXPECTED; | 1547 return NGX_HTTP_V3_ERR_FRAME_UNEXPECTED; |
1539 } | 1548 } |
1541 st->state = sw_length; | 1550 st->state = sw_length; |
1542 break; | 1551 break; |
1543 | 1552 |
1544 case sw_length: | 1553 case sw_length: |
1545 | 1554 |
1546 if (ngx_http_v3_parse_varlen_int(c, &st->vlint, ch) != NGX_DONE) { | 1555 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, ch); |
1547 break; | 1556 if (rc != NGX_DONE) { |
1557 return rc; | |
1548 } | 1558 } |
1549 | 1559 |
1550 st->length = st->vlint.value; | 1560 st->length = st->vlint.value; |
1551 | 1561 |
1552 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | 1562 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |