Mercurial > hg > nginx-vendor-current
comparison src/core/ngx_inet.c @ 676:bfa81a0490a2 NGINX_1_3_1
nginx 1.3.1
*) Security: now nginx/Windows ignores trailing dot in URI path
component, and does not allow URIs with ":$" in it.
Thanks to Vladimir Kochetkov, Positive Research Center.
*) Feature: the "proxy_pass", "fastcgi_pass", "scgi_pass", "uwsgi_pass"
directives, and the "server" directive inside the "upstream" block,
now support IPv6 addresses.
*) Feature: the "resolver" directive now support IPv6 addresses and an
optional port specification.
*) Feature: the "least_conn" directive inside the "upstream" block.
*) Feature: it is now possible to specify a weight for servers while
using the "ip_hash" directive.
*) Bugfix: a segmentation fault might occur in a worker process if the
"image_filter" directive was used; the bug had appeared in 1.3.0.
*) Bugfix: nginx could not be built with ngx_cpp_test_module; the bug
had appeared in 1.1.12.
*) Bugfix: access to variables from SSI and embedded perl module might
not work after reconfiguration.
Thanks to Yichun Zhang.
*) Bugfix: in the ngx_http_xslt_filter_module.
Thanks to Kuramoto Eiji.
*) Bugfix: memory leak if $geoip_org variable was used.
Thanks to Denis F. Latypoff.
*) Bugfix: in the "proxy_cookie_domain" and "proxy_cookie_path"
directives.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 05 Jun 2012 00:00:00 +0400 |
parents | ad45b044f1e5 |
children | 88a1b4797f2e |
comparison
equal
deleted
inserted
replaced
675:7052a9379344 | 676:bfa81a0490a2 |
---|---|
520 | 520 |
521 if (ngx_strncasecmp(p, (u_char *) "unix:", 5) == 0) { | 521 if (ngx_strncasecmp(p, (u_char *) "unix:", 5) == 0) { |
522 return ngx_parse_unix_domain_url(pool, u); | 522 return ngx_parse_unix_domain_url(pool, u); |
523 } | 523 } |
524 | 524 |
525 if ((p[0] == ':' || p[0] == '/') && !u->listen) { | |
526 u->err = "invalid host"; | |
527 return NGX_ERROR; | |
528 } | |
529 | |
530 if (p[0] == '[') { | 525 if (p[0] == '[') { |
531 return ngx_parse_inet6_url(pool, u); | 526 return ngx_parse_inet6_url(pool, u); |
532 } | 527 } |
533 | 528 |
534 return ngx_parse_inet_url(pool, u); | 529 return ngx_parse_inet_url(pool, u); |
637 uri = ngx_strlchr(host, last, '/'); | 632 uri = ngx_strlchr(host, last, '/'); |
638 | 633 |
639 args = ngx_strlchr(host, last, '?'); | 634 args = ngx_strlchr(host, last, '?'); |
640 | 635 |
641 if (args) { | 636 if (args) { |
642 if (uri == NULL) { | 637 if (uri == NULL || args < uri) { |
643 uri = args; | |
644 | |
645 } else if (args < uri) { | |
646 uri = args; | 638 uri = args; |
647 } | 639 } |
648 } | 640 } |
649 | 641 |
650 if (uri) { | 642 if (uri) { |
665 | 657 |
666 if (port) { | 658 if (port) { |
667 port++; | 659 port++; |
668 | 660 |
669 len = last - port; | 661 len = last - port; |
670 | |
671 if (len == 0) { | |
672 u->err = "invalid port"; | |
673 return NGX_ERROR; | |
674 } | |
675 | 662 |
676 n = ngx_atoi(port, len); | 663 n = ngx_atoi(port, len); |
677 | 664 |
678 if (n < 1 || n > 65535) { | 665 if (n < 1 || n > 65535) { |
679 u->err = "invalid port"; | 666 u->err = "invalid port"; |
777 | 764 |
778 if (u->listen) { | 765 if (u->listen) { |
779 return NGX_OK; | 766 return NGX_OK; |
780 } | 767 } |
781 | 768 |
782 if (ngx_inet_resolve_host(pool, u) != NGX_OK) { | 769 return ngx_inet_resolve_host(pool, u); |
783 return NGX_ERROR; | |
784 } | |
785 | |
786 return NGX_OK; | |
787 } | 770 } |
788 | 771 |
789 | 772 |
790 static ngx_int_t | 773 static ngx_int_t |
791 ngx_parse_inet6_url(ngx_pool_t *pool, ngx_url_t *u) | 774 ngx_parse_inet6_url(ngx_pool_t *pool, ngx_url_t *u) |
823 return NGX_ERROR; | 806 return NGX_ERROR; |
824 } | 807 } |
825 | 808 |
826 u->uri.len = last - uri; | 809 u->uri.len = last - uri; |
827 u->uri.data = uri; | 810 u->uri.data = uri; |
811 | |
812 last = uri; | |
828 } | 813 } |
829 | 814 |
830 if (*port == ':') { | 815 if (*port == ':') { |
831 port++; | 816 port++; |
832 | 817 |
833 len = last - port; | 818 len = last - port; |
834 | |
835 if (len == 0) { | |
836 u->err = "invalid port"; | |
837 return NGX_ERROR; | |
838 } | |
839 | 819 |
840 n = ngx_atoi(port, len); | 820 n = ngx_atoi(port, len); |
841 | 821 |
842 if (n < 1 || n > 65535) { | 822 if (n < 1 || n > 65535) { |
843 u->err = "invalid port"; | 823 u->err = "invalid port"; |
860 if (len == 0) { | 840 if (len == 0) { |
861 u->err = "no host"; | 841 u->err = "no host"; |
862 return NGX_ERROR; | 842 return NGX_ERROR; |
863 } | 843 } |
864 | 844 |
865 u->host.len = len; | 845 u->host.len = len + 2; |
866 u->host.data = host; | 846 u->host.data = host - 1; |
867 | 847 |
868 if (ngx_inet6_addr(host, len, sin6->sin6_addr.s6_addr) != NGX_OK) { | 848 if (ngx_inet6_addr(host, len, sin6->sin6_addr.s6_addr) != NGX_OK) { |
869 u->err = "invalid IPv6 address"; | 849 u->err = "invalid IPv6 address"; |
870 return NGX_ERROR; | 850 return NGX_ERROR; |
871 } | 851 } |
872 | 852 |
873 if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { | 853 if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { |
874 u->wildcard = 1; | 854 u->wildcard = 1; |
875 } | |
876 | |
877 u->family = AF_INET6; | |
878 | |
879 if (u->no_resolve) { | |
880 return NGX_OK; | |
881 } | 855 } |
882 | 856 |
883 if (u->no_port) { | 857 if (u->no_port) { |
884 u->port = u->default_port; | 858 u->port = u->default_port; |
885 sin6->sin6_port = htons(u->default_port); | 859 sin6->sin6_port = htons(u->default_port); |
886 } | 860 } |
861 | |
862 u->family = AF_INET6; | |
863 u->naddrs = 1; | |
864 | |
865 u->addrs = ngx_pcalloc(pool, sizeof(ngx_addr_t)); | |
866 if (u->addrs == NULL) { | |
867 return NGX_ERROR; | |
868 } | |
869 | |
870 sin6 = ngx_pcalloc(pool, sizeof(struct sockaddr_in6)); | |
871 if (sin6 == NULL) { | |
872 return NGX_ERROR; | |
873 } | |
874 | |
875 ngx_memcpy(sin6, u->sockaddr, sizeof(struct sockaddr_in6)); | |
876 | |
877 u->addrs[0].sockaddr = (struct sockaddr *) sin6; | |
878 u->addrs[0].socklen = sizeof(struct sockaddr_in6); | |
879 | |
880 p = ngx_pnalloc(pool, u->host.len + sizeof(":65535") - 1); | |
881 if (p == NULL) { | |
882 return NGX_ERROR; | |
883 } | |
884 | |
885 u->addrs[0].name.len = ngx_sprintf(p, "%V:%d", | |
886 &u->host, u->port) - p; | |
887 u->addrs[0].name.data = p; | |
887 | 888 |
888 return NGX_OK; | 889 return NGX_OK; |
889 | 890 |
890 #else | 891 #else |
891 | 892 |