Mercurial > hg > nginx-vendor-0-7
comparison src/core/ngx_string.c @ 206:3866d57d9cfd NGINX_0_3_50
nginx 0.3.50
*) Change: the "proxy_redirect_errors" and "fastcgi_redirect_errors"
directives was renamed to the "proxy_intercept_errors" and
"fastcgi_intercept_errors" directives.
*) Feature: the ngx_http_charset_module supports the recoding from the
single byte encodings to the UTF-8 encoding and back.
*) Feature: the "X-Accel-Charset" response header line is supported in
proxy and FastCGI mode.
*) Bugfix: the "\" escape symbol in the "\"" and "\'" pairs in the SSI
command was removed only if the command also has the "$" symbol.
*) Bugfix: the "<!--" string might be added on some conditions in the
SSI after inclusion.
*) Bugfix: if the "Content-Length: 0" header line was in response, then
in nonbuffered proxying mode the client connection was not closed.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 28 Jun 2006 00:00:00 +0400 |
parents | 6be073125f2e |
children | fbf2b2f66c9f |
comparison
equal
deleted
inserted
replaced
205:e53bd15c244a | 206:3866d57d9cfd |
---|---|
748 | 748 |
749 return NGX_OK; | 749 return NGX_OK; |
750 } | 750 } |
751 | 751 |
752 | 752 |
753 /* | |
754 * ngx_utf_decode() decodes two and more bytes UTF sequences only | |
755 * the return values: | |
756 * 0x80 - 0x10ffff valid character | |
757 * 0x10ffff - 0xfffffffd invalid sequence | |
758 * 0xfffffffe incomplete sequence | |
759 * 0xffffffff error | |
760 */ | |
761 | |
762 uint32_t | |
763 ngx_utf_decode(u_char **p, size_t n) | |
764 { | |
765 size_t len; | |
766 uint32_t u, i, valid; | |
767 | |
768 u = **p; | |
769 | |
770 if (u > 0xf0) { | |
771 | |
772 u &= 0x07; | |
773 valid = 0xffff; | |
774 len = 3; | |
775 | |
776 } else if (u > 0xe0) { | |
777 | |
778 u &= 0x0f; | |
779 valid = 0x7ff; | |
780 len = 2; | |
781 | |
782 } else if (u > 0xc0) { | |
783 | |
784 u &= 0x1f; | |
785 valid = 0x7f; | |
786 len = 1; | |
787 | |
788 } else { | |
789 (*p)++; | |
790 return 0xffffffff; | |
791 } | |
792 | |
793 if (n - 1 < len) { | |
794 return 0xfffffffe; | |
795 } | |
796 | |
797 (*p)++; | |
798 | |
799 while (len) { | |
800 i = *(*p)++; | |
801 | |
802 if (i < 0x80) { | |
803 return 0xffffffff; | |
804 } | |
805 | |
806 u = (u << 6) | (i & 0x3f); | |
807 | |
808 len--; | |
809 } | |
810 | |
811 if (u > valid) { | |
812 return u; | |
813 } | |
814 | |
815 return 0xffffffff; | |
816 } | |
817 | |
818 | |
753 size_t | 819 size_t |
754 ngx_utf_length(ngx_str_t *utf) | 820 ngx_utf_length(u_char *p, size_t n) |
755 { | 821 { |
756 u_char c; | 822 u_char c; |
757 size_t len; | 823 size_t len; |
758 ngx_uint_t i; | 824 ngx_uint_t i; |
759 | 825 |
760 for (len = 0, i = 0; i < utf->len; len++, i++) { | 826 for (len = 0, i = 0; i < n; len++, i++) { |
761 | 827 |
762 c = utf->data[i]; | 828 c = p[i]; |
763 | 829 |
764 if (c < 0x80) { | 830 if (c < 0x80) { |
765 continue; | 831 continue; |
766 } | 832 } |
767 | 833 |
773 continue; | 839 continue; |
774 } | 840 } |
775 | 841 |
776 /* invalid utf */ | 842 /* invalid utf */ |
777 | 843 |
778 return utf->len; | 844 return n; |
779 } | 845 } |
780 | 846 |
781 return len; | 847 return len; |
782 } | 848 } |
783 | 849 |