Deleted
Added
nxt_string.c (963:d847762b684b) | nxt_string.c (1167:a49ee872e83d) |
---|---|
1 2/* 3 * Copyright (C) Igor Sysoev 4 * Copyright (C) NGINX, Inc. 5 */ 6 7#include <nxt_main.h> 8 --- 437 unchanged lines hidden (view full) --- 446 if (nxt_isdigit(last) != nxt_isdigit(next)) { 447 /* This is a version part boundary. */ 448 return 1; 449 } 450 } 451 452 return 0; 453} | 1 2/* 3 * Copyright (C) Igor Sysoev 4 * Copyright (C) NGINX, Inc. 5 */ 6 7#include <nxt_main.h> 8 --- 437 unchanged lines hidden (view full) --- 446 if (nxt_isdigit(last) != nxt_isdigit(next)) { 447 /* This is a version part boundary. */ 448 return 1; 449 } 450 } 451 452 return 0; 453} |
454 455 456u_char * 457nxt_decode_uri(u_char *dst, u_char *src, size_t length) 458{ 459 u_char *end, ch; 460 uint8_t d0, d1; 461 462 static const uint8_t hex[256] 463 nxt_aligned(32) = 464 { 465 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 466 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 467 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 468 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 16, 16, 16, 16, 16, 16, 469 16, 10, 11, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 470 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 471 16, 10, 11, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 472 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 473 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 474 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 475 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 476 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 477 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 478 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 479 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 480 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 481 }; 482 483 nxt_prefetch(&hex['0']); 484 485 end = src + length; 486 487 while (src < end) { 488 ch = *src++; 489 490 if (ch == '%') { 491 if (nxt_slow_path(end - src < 2)) { 492 return NULL; 493 } 494 495 d0 = hex[*src++]; 496 d1 = hex[*src++]; 497 498 if (nxt_slow_path((d0 | d1) >= 16)) { 499 return NULL; 500 } 501 502 ch = (d0 << 4) + d1; 503 } 504 505 *dst++ = ch; 506 } 507 508 return dst; 509} |
|