nxt_http_chunk_parse.c (611:323e11065f83) nxt_http_chunk_parse.c (704:1fcac04f0a15)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8

--- 91 unchanged lines hidden (view full) ---

100 c = ch - '0';
101
102 if (c > 9) {
103 c = (ch | 0x20) - 'a';
104
105 if (nxt_fast_path(c <= 5)) {
106 c += 0x0A;
107
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8

--- 91 unchanged lines hidden (view full) ---

100 c = ch - '0';
101
102 if (c > 9) {
103 c = (ch | 0x20) - 'a';
104
105 if (nxt_fast_path(c <= 5)) {
106 c += 0x0A;
107
108 } else if (nxt_fast_path(ch == NXT_CR)) {
108 } else if (nxt_fast_path(ch == '\r')) {
109 state = sw_chunk_size_linefeed;
110 continue;
111
112 } else {
113 goto chunk_error;
114 }
115 }
116
117 if (nxt_fast_path(nxt_size_is_sufficient(hcp->chunk_size))) {
118 hcp->chunk_size = (hcp->chunk_size << 4) + c;
119 continue;
120 }
121
122 goto chunk_error;
123
124 case sw_chunk_size_linefeed:
109 state = sw_chunk_size_linefeed;
110 continue;
111
112 } else {
113 goto chunk_error;
114 }
115 }
116
117 if (nxt_fast_path(nxt_size_is_sufficient(hcp->chunk_size))) {
118 hcp->chunk_size = (hcp->chunk_size << 4) + c;
119 continue;
120 }
121
122 goto chunk_error;
123
124 case sw_chunk_size_linefeed:
125 if (nxt_fast_path(ch == NXT_LF)) {
125 if (nxt_fast_path(ch == '\n')) {
126
127 if (hcp->chunk_size != 0) {
128 state = sw_chunk;
129 continue;
130 }
131
132 hcp->last = 1;
133 state = sw_chunk_end_newline;
134 continue;
135 }
136
137 goto chunk_error;
138
139 case sw_chunk_end_newline:
126
127 if (hcp->chunk_size != 0) {
128 state = sw_chunk;
129 continue;
130 }
131
132 hcp->last = 1;
133 state = sw_chunk_end_newline;
134 continue;
135 }
136
137 goto chunk_error;
138
139 case sw_chunk_end_newline:
140 if (nxt_fast_path(ch == NXT_CR)) {
140 if (nxt_fast_path(ch == '\r')) {
141 state = sw_chunk_end_linefeed;
142 continue;
143 }
144
145 goto chunk_error;
146
147 case sw_chunk_end_linefeed:
141 state = sw_chunk_end_linefeed;
142 continue;
143 }
144
145 goto chunk_error;
146
147 case sw_chunk_end_linefeed:
148 if (nxt_fast_path(ch == NXT_LF)) {
148 if (nxt_fast_path(ch == '\n')) {
149
150 if (!hcp->last) {
151 state = sw_start;
152 continue;
153 }
154
155 goto done;
156 }

--- 107 unchanged lines hidden ---
149
150 if (!hcp->last) {
151 state = sw_start;
152 continue;
153 }
154
155 goto done;
156 }

--- 107 unchanged lines hidden ---