comparison src/http/modules/ngx_http_log_module.c @ 540:c04fa65fe604 NGINX_0_8_22

nginx 0.8.22 *) Feature: the "proxy_bind", "fastcgi_bind", and "memcached_bind" directives. *) Feature: the "access" and the "deny" directives support IPv6. *) Feature: the "set_real_ip_from" directive supports IPv6 addresses in request headers. *) Feature: the "unix:" parameter of the "set_real_ip_from" directive. *) Bugfix: nginx did not delete unix domain socket after configuration testing. *) Bugfix: nginx deleted unix domain socket while online upgrade. *) Bugfix: the "!-x" operator did not work. Thanks to Maxim Dounin. *) Bugfix: a segmentation fault might occur in a worker process, if limit_rate was used in HTTPS server. Thanks to Maxim Dounin. *) Bugfix: a segmentation fault might occur in a worker process while $limit_rate logging. Thanks to Maxim Dounin. *) Bugfix: a segmentation fault might occur in a worker process, if there was no "listen" directive in "server" block; the bug had appeared in 0.8.21.
author Igor Sysoev <http://sysoev.ru>
date Tue, 03 Nov 2009 00:00:00 +0300
parents 0161f3197817
children 5c576ea5dbd9
comparison
equal deleted inserted replaced
539:c88014f74832 540:c04fa65fe604
648 648
649 649
650 static uintptr_t 650 static uintptr_t
651 ngx_http_log_escape(u_char *dst, u_char *src, size_t size) 651 ngx_http_log_escape(u_char *dst, u_char *src, size_t size)
652 { 652 {
653 ngx_uint_t i, n; 653 ngx_uint_t n;
654 static u_char hex[] = "0123456789ABCDEF"; 654 static u_char hex[] = "0123456789ABCDEF";
655 655
656 static uint32_t escape[] = { 656 static uint32_t escape[] = {
657 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ 657 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */
658 658
676 676
677 /* find the number of the characters to be escaped */ 677 /* find the number of the characters to be escaped */
678 678
679 n = 0; 679 n = 0;
680 680
681 for (i = 0; i < size; i++) { 681 while (size) {
682 if (escape[*src >> 5] & (1 << (*src & 0x1f))) { 682 if (escape[*src >> 5] & (1 << (*src & 0x1f))) {
683 n++; 683 n++;
684 } 684 }
685 src++; 685 src++;
686 size--;
686 } 687 }
687 688
688 return (uintptr_t) n; 689 return (uintptr_t) n;
689 } 690 }
690 691
691 for (i = 0; i < size; i++) { 692 while (size) {
692 if (escape[*src >> 5] & (1 << (*src & 0x1f))) { 693 if (escape[*src >> 5] & (1 << (*src & 0x1f))) {
693 *dst++ = '\\'; 694 *dst++ = '\\';
694 *dst++ = 'x'; 695 *dst++ = 'x';
695 *dst++ = hex[*src >> 4]; 696 *dst++ = hex[*src >> 4];
696 *dst++ = hex[*src & 0xf]; 697 *dst++ = hex[*src & 0xf];
697 src++; 698 src++;
698 699
699 } else { 700 } else {
700 *dst++ = *src++; 701 *dst++ = *src++;
701 } 702 }
703 size--;
702 } 704 }
703 705
704 return (uintptr_t) dst; 706 return (uintptr_t) dst;
705 } 707 }
706 708