nxt_http_parse.c (409:703c6b2bb0ac) nxt_http_parse.c (410:35d3565882ac)
1
2/*
3 * Copyright (C) NGINX, Inc.
4 * Copyright (C) Valentin V. Bartenev
5 */
6
7#include <nxt_main.h>
8

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

113 nxt_target_test_char(p[7]);
114
115 nxt_target_test_char(p[8]);
116 nxt_target_test_char(p[9]);
117
118 p += 10;
119 }
120
1
2/*
3 * Copyright (C) NGINX, Inc.
4 * Copyright (C) Valentin V. Bartenev
5 */
6
7#include <nxt_main.h>
8

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

113 nxt_target_test_char(p[7]);
114
115 nxt_target_test_char(p[8]);
116 nxt_target_test_char(p[9]);
117
118 p += 10;
119 }
120
121 while (p != end) {
122 nxt_target_test_char(*p); p++;
123 }
124
121 return NXT_HTTP_TARGET_AGAIN;
122}
123
124
125nxt_int_t
126nxt_http_parse_request(nxt_http_request_parse_t *rp, nxt_buf_mem_t *b)
127{
128 nxt_int_t rc;

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

176 nxt_method_test_char(p[4]);
177 nxt_method_test_char(p[5]);
178 nxt_method_test_char(p[6]);
179 nxt_method_test_char(p[7]);
180
181 p += 8;
182 }
183
125 return NXT_HTTP_TARGET_AGAIN;
126}
127
128
129nxt_int_t
130nxt_http_parse_request(nxt_http_request_parse_t *rp, nxt_buf_mem_t *b)
131{
132 nxt_int_t rc;

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

180 nxt_method_test_char(p[4]);
181 nxt_method_test_char(p[5]);
182 nxt_method_test_char(p[6]);
183 nxt_method_test_char(p[7]);
184
185 p += 8;
186 }
187
188 while (p != end) {
189 nxt_method_test_char(*p); p++;
190 }
191
184 return NXT_AGAIN;
185
186 method_unusual_char:
187
188 ch = *p;
189
190 if (nxt_fast_path(ch == ' ')) {
191 rp->method.length = p - rp->method.start;

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

311 }
312
313 nxt_unreachable();
314 }
315
316space_after_target:
317
318 if (nxt_slow_path(end - p < 10)) {
192 return NXT_AGAIN;
193
194 method_unusual_char:
195
196 ch = *p;
197
198 if (nxt_fast_path(ch == ' ')) {
199 rp->method.length = p - rp->method.start;

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

319 }
320
321 nxt_unreachable();
322 }
323
324space_after_target:
325
326 if (nxt_slow_path(end - p < 10)) {
319 return NXT_AGAIN;
327
328 do {
329 p++;
330
331 if (p == end) {
332 return NXT_AGAIN;
333 }
334
335 } while (*p == ' ');
336
337 if (nxt_memcmp(p, "HTTP/", nxt_min(end - p, 5)) == 0) {
338
339 switch (end - p) {
340 case 8:
341 if (p[7] < '0' || p[7] > '9') {
342 break;
343 }
344 /* Fall through. */
345 case 7:
346 if (p[6] != '.') {
347 break;
348 }
349 /* Fall through. */
350 case 6:
351 if (p[5] < '0' || p[5] > '9') {
352 break;
353 }
354 /* Fall through. */
355 default:
356 return NXT_AGAIN;
357 }
358 }
359
360 rp->space_in_target = 1;
361 goto rest_of_target;
320 }
321
322 /* " HTTP/1.1\r\n" or " HTTP/1.1\n" */
323
324 nxt_memcpy(version.str, &p[1], 8);
325
326 if (nxt_fast_path((version.ui64 == http11.ui64
327 || version.ui64 == http10.ui64

--- 893 unchanged lines hidden ---
362 }
363
364 /* " HTTP/1.1\r\n" or " HTTP/1.1\n" */
365
366 nxt_memcpy(version.str, &p[1], 8);
367
368 if (nxt_fast_path((version.ui64 == http11.ui64
369 || version.ui64 == http10.ui64

--- 893 unchanged lines hidden ---