Mercurial > hg > nginx-vendor-0-7
comparison src/core/ngx_string.c @ 254:f3ec44f4a53b NGINX_0_4_12
nginx 0.4.12
*) Feature: the ngx_http_perl_module supports the $r->variable method.
*) Bugfix: if a big static file was included using SSI in a response,
then the response may be transferred incomplete.
*) Bugfix: nginx did not omit the "#fragment" part in URI.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 31 Oct 2006 00:00:00 +0300 |
parents | fbf2b2f66c9f |
children | 052a7b1d40e5 |
comparison
equal
deleted
inserted
replaced
253:b75231e1a353 | 254:f3ec44f4a53b |
---|---|
686 ngx_int_t | 686 ngx_int_t |
687 ngx_decode_base64(ngx_str_t *dst, ngx_str_t *src) | 687 ngx_decode_base64(ngx_str_t *dst, ngx_str_t *src) |
688 { | 688 { |
689 size_t len; | 689 size_t len; |
690 u_char *d, *s; | 690 u_char *d, *s; |
691 static u_char basis64[] = | 691 static u_char basis64[] = { |
692 { 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | 692 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
693 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | 693 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
694 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 62, 77, 77, 77, 63, | 694 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 62, 77, 77, 77, 63, |
695 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 77, 77, 77, 77, 77, 77, | 695 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 77, 77, 77, 77, 77, 77, |
696 77, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | 696 77, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
697 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 77, 77, 77, 77, 77, | 697 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 77, 77, 77, 77, 77, |
698 77, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, | 698 77, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, |
699 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 77, 77, 77, 77, 77, | 699 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 77, 77, 77, 77, 77, |
700 | 700 |
701 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | 701 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
702 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | 702 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
703 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | 703 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
704 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | 704 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
705 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | 705 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
706 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | 706 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
707 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | 707 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
708 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77 }; | 708 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77 |
709 }; | |
709 | 710 |
710 for (len = 0; len < src->len; len++) { | 711 for (len = 0; len < src->len; len++) { |
711 if (src->data[len] == '=') { | 712 if (src->data[len] == '=') { |
712 break; | 713 break; |
713 } | 714 } |
885 | 886 |
886 | 887 |
887 uintptr_t | 888 uintptr_t |
888 ngx_escape_uri(u_char *dst, u_char *src, size_t size, ngx_uint_t type) | 889 ngx_escape_uri(u_char *dst, u_char *src, size_t size, ngx_uint_t type) |
889 { | 890 { |
890 ngx_uint_t i, n; | 891 ngx_uint_t i, n; |
891 uint32_t *escape; | 892 uint32_t *escape; |
892 static u_char hex[] = "0123456789abcdef"; | 893 static u_char hex[] = "0123456789abcdef"; |
893 | 894 |
894 /* " ", "#", "%", "?", %00-%1F, %7F-%FF */ | 895 /* " ", "#", "%", "?", %00-%1F, %7F-%FF */ |
895 | 896 |
896 static uint32_t uri[] = | 897 static uint32_t uri[] = { |
897 { 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ | 898 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ |
898 | 899 |
899 /* ?>=< ;:98 7654 3210 /.-, +*)( '&%$ #"! */ | 900 /* ?>=< ;:98 7654 3210 /.-, +*)( '&%$ #"! */ |
900 0x80000029, /* 1000 0000 0000 0000 0000 0000 0010 1001 */ | 901 0x80000029, /* 1000 0000 0000 0000 0000 0000 0010 1001 */ |
901 | 902 |
902 /* _^]\ [ZYX WVUT SRQP ONML KJIH GFED CBA@ */ | 903 /* _^]\ [ZYX WVUT SRQP ONML KJIH GFED CBA@ */ |
903 0x00000000, /* 0000 0000 0000 0000 0000 0000 0000 0000 */ | 904 0x00000000, /* 0000 0000 0000 0000 0000 0000 0000 0000 */ |
904 | 905 |
905 /* ~}| {zyx wvut srqp onml kjih gfed cba` */ | 906 /* ~}| {zyx wvut srqp onml kjih gfed cba` */ |
906 0x80000000, /* 1000 0000 0000 0000 0000 0000 0000 0000 */ | 907 0x80000000, /* 1000 0000 0000 0000 0000 0000 0000 0000 */ |
907 | 908 |
908 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ | 909 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ |
909 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ | 910 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ |
910 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ | 911 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ |
911 0xffffffff /* 1111 1111 1111 1111 1111 1111 1111 1111 */ }; | 912 0xffffffff /* 1111 1111 1111 1111 1111 1111 1111 1111 */ |
912 | 913 }; |
913 /* " ", "#", "%", "+", "?", %00-%1F, %7F-%FF */ | 914 |
914 | 915 /* " ", "#", "%", "+", "?", %00-%1F, %7F-%FF */ |
915 static uint32_t args[] = | 916 |
916 { 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ | 917 static uint32_t args[] = { |
917 | 918 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ |
918 /* ?>=< ;:98 7654 3210 /.-, +*)( '&%$ #"! */ | 919 |
919 0x80000829, /* 1000 0000 0000 0000 0000 1000 0010 1001 */ | 920 /* ?>=< ;:98 7654 3210 /.-, +*)( '&%$ #"! */ |
920 | 921 0x80000829, /* 1000 0000 0000 0000 0000 1000 0010 1001 */ |
921 /* _^]\ [ZYX WVUT SRQP ONML KJIH GFED CBA@ */ | 922 |
922 0x00000000, /* 0000 0000 0000 0000 0000 0000 0000 0000 */ | 923 /* _^]\ [ZYX WVUT SRQP ONML KJIH GFED CBA@ */ |
923 | 924 0x00000000, /* 0000 0000 0000 0000 0000 0000 0000 0000 */ |
924 /* ~}| {zyx wvut srqp onml kjih gfed cba` */ | 925 |
925 0x80000000, /* 1000 0000 0000 0000 0000 0000 0000 0000 */ | 926 /* ~}| {zyx wvut srqp onml kjih gfed cba` */ |
926 | 927 0x80000000, /* 1000 0000 0000 0000 0000 0000 0000 0000 */ |
927 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ | 928 |
928 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ | 929 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ |
929 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ | 930 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ |
930 0xffffffff /* 1111 1111 1111 1111 1111 1111 1111 1111 */ }; | 931 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ |
931 | 932 0xffffffff /* 1111 1111 1111 1111 1111 1111 1111 1111 */ |
932 /* " ", """, "%", "'", %00-%1F, %7F-%FF */ | 933 }; |
933 | 934 |
934 static uint32_t html[] = | 935 /* " ", """, "%", "'", %00-%1F, %7F-%FF */ |
935 { 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ | 936 |
936 | 937 static uint32_t html[] = { |
937 /* ?>=< ;:98 7654 3210 /.-, +*)( '&%$ #"! */ | 938 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ |
938 0x800000ad, /* 0000 0000 0000 0000 0000 0000 1010 1101 */ | 939 |
939 | 940 /* ?>=< ;:98 7654 3210 /.-, +*)( '&%$ #"! */ |
940 /* _^]\ [ZYX WVUT SRQP ONML KJIH GFED CBA@ */ | 941 0x800000ad, /* 0000 0000 0000 0000 0000 0000 1010 1101 */ |
941 0x00000000, /* 0000 0000 0000 0000 0000 0000 0000 0000 */ | 942 |
942 | 943 /* _^]\ [ZYX WVUT SRQP ONML KJIH GFED CBA@ */ |
943 /* ~}| {zyx wvut srqp onml kjih gfed cba` */ | 944 0x00000000, /* 0000 0000 0000 0000 0000 0000 0000 0000 */ |
944 0x80000000, /* 1000 0000 0000 0000 0000 0000 0000 0000 */ | 945 |
945 | 946 /* ~}| {zyx wvut srqp onml kjih gfed cba` */ |
946 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ | 947 0x80000000, /* 1000 0000 0000 0000 0000 0000 0000 0000 */ |
947 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ | 948 |
948 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ | 949 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ |
949 0xffffffff /* 1111 1111 1111 1111 1111 1111 1111 1111 */ }; | 950 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ |
951 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ | |
952 0xffffffff /* 1111 1111 1111 1111 1111 1111 1111 1111 */ | |
953 }; | |
950 | 954 |
951 | 955 |
952 switch (type) { | 956 switch (type) { |
953 case NGX_ESCAPE_HTML: | 957 case NGX_ESCAPE_HTML: |
954 escape = html; | 958 escape = html; |