nxt_http_parse.c (480:11b28d6fc462) nxt_http_parse.c (481:4bfbd8ce0e8a)
1
2/*
3 * Copyright (C) NGINX, Inc.
4 * Copyright (C) Valentin V. Bartenev
5 */
6
7#include <nxt_main.h>
8

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

164
165
166static nxt_int_t
167nxt_http_parse_request_line(nxt_http_request_parse_t *rp, u_char **pos,
168 u_char *end)
169{
170 u_char *p, ch, *after_slash;
171 nxt_int_t rc;
1
2/*
3 * Copyright (C) NGINX, Inc.
4 * Copyright (C) Valentin V. Bartenev
5 */
6
7#include <nxt_main.h>
8

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

164
165
166static nxt_int_t
167nxt_http_parse_request_line(nxt_http_request_parse_t *rp, u_char **pos,
168 u_char *end)
169{
170 u_char *p, ch, *after_slash;
171 nxt_int_t rc;
172 nxt_http_ver_t version;
172 nxt_http_ver_t ver;
173 nxt_http_target_traps_e trap;
174
175 static const nxt_http_ver_t http11 = { "HTTP/1.1" };
176 static const nxt_http_ver_t http10 = { "HTTP/1.0" };
177
178 p = *pos;
179
180 rp->method.start = p;

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

378 }
379
380 rp->space_in_target = 1;
381 goto rest_of_target;
382 }
383
384 /* " HTTP/1.1\r\n" or " HTTP/1.1\n" */
385
173 nxt_http_target_traps_e trap;
174
175 static const nxt_http_ver_t http11 = { "HTTP/1.1" };
176 static const nxt_http_ver_t http10 = { "HTTP/1.0" };
177
178 p = *pos;
179
180 rp->method.start = p;

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

378 }
379
380 rp->space_in_target = 1;
381 goto rest_of_target;
382 }
383
384 /* " HTTP/1.1\r\n" or " HTTP/1.1\n" */
385
386 nxt_memcpy(version.str, &p[1], 8);
386 nxt_memcpy(ver.str, &p[1], 8);
387
387
388 if (nxt_fast_path((version.ui64 == http11.ui64
389 || version.ui64 == http10.ui64
390 || (p[1] == 'H'
391 && p[2] == 'T'
392 && p[3] == 'T'
393 && p[4] == 'P'
394 && p[5] == '/'
395 && p[6] >= '0' && p[6] <= '9'
396 && p[7] == '.'
397 && p[8] >= '0' && p[8] <= '9'))
388 if (nxt_fast_path((ver.ui64 == http11.ui64
389 || ver.ui64 == http10.ui64
390 || (nxt_memcmp(ver.s.prefix, "HTTP/", 5) == 0
391 && ver.s.major >= '0' && ver.s.major <= '9'
392 && ver.s.point == '.'
393 && ver.s.minor >= '0' && ver.s.minor <= '9'))
398 && (p[9] == '\r' || p[9] == '\n')))
399 {
394 && (p[9] == '\r' || p[9] == '\n')))
395 {
400 rp->version.ui64 = version.ui64;
396 rp->version.ui64 = ver.ui64;
401
402 if (nxt_fast_path(p[9] == '\r')) {
403 p += 10;
404
405 if (nxt_slow_path(p == end)) {
406 return NXT_AGAIN;
407 }
408

--- 845 unchanged lines hidden ---
397
398 if (nxt_fast_path(p[9] == '\r')) {
399 p += 10;
400
401 if (nxt_slow_path(p == end)) {
402 return NXT_AGAIN;
403 }
404

--- 845 unchanged lines hidden ---