comparison src/http/modules/ngx_http_proxy_module.c @ 140:55a211e5eeb7 NGINX_0_3_17

nginx 0.3.17 *) Change: now on Linux configure checks the presence of epoll and sendfile64() in kernel. *) Feature: the "map" directive supports domain names in the ".domain.tld" form. *) Bugfix: the timeouts were not used in SSL handshake; bug appeared in 0.2.4. *) Bugfix: in the HTTPS protocol in the "proxy_pass" directive. *) Bugfix: when the HTTPS protocol was used in the "proxy_pass" directive the port 80 was used by default.
author Igor Sysoev <http://sysoev.ru>
date Sun, 18 Dec 2005 00:00:00 +0300
parents 8e6d4d96ec4c
children 84910468f6de
comparison
equal deleted inserted replaced
139:9cee8bc94578 140:55a211e5eeb7
1924 { 1924 {
1925 ngx_http_proxy_loc_conf_t *plcf = conf; 1925 ngx_http_proxy_loc_conf_t *plcf = conf;
1926 1926
1927 size_t add; 1927 size_t add;
1928 ngx_str_t *value, *url; 1928 ngx_str_t *value, *url;
1929 ngx_uint_t port;
1929 ngx_inet_upstream_t inet_upstream; 1930 ngx_inet_upstream_t inet_upstream;
1930 ngx_http_core_loc_conf_t *clcf; 1931 ngx_http_core_loc_conf_t *clcf;
1931 #if (NGX_HTTP_SSL) 1932 #if (NGX_HTTP_SSL)
1932 ngx_pool_cleanup_t *cln; 1933 ngx_pool_cleanup_t *cln;
1933 #endif 1934 #endif
1943 1944
1944 url = &value[1]; 1945 url = &value[1];
1945 1946
1946 if (ngx_strncasecmp(url->data, "http://", 7) == 0) { 1947 if (ngx_strncasecmp(url->data, "http://", 7) == 0) {
1947 add = 7; 1948 add = 7;
1949 port = 80;
1948 1950
1949 } else if (ngx_strncasecmp(url->data, "https://", 8) == 0) { 1951 } else if (ngx_strncasecmp(url->data, "https://", 8) == 0) {
1950 1952
1951 #if (NGX_HTTP_SSL) 1953 #if (NGX_HTTP_SSL)
1952 1954
1953 add = 8; 1955 add = 8;
1956 port = 443;
1954 1957
1955 plcf->upstream.ssl = ngx_pcalloc(cf->pool, sizeof(ngx_ssl_t)); 1958 plcf->upstream.ssl = ngx_pcalloc(cf->pool, sizeof(ngx_ssl_t));
1956 if (plcf->upstream.ssl == NULL) { 1959 if (plcf->upstream.ssl == NULL) {
1957 return NGX_CONF_ERROR; 1960 return NGX_CONF_ERROR;
1958 } 1961 }
2017 ngx_memzero(&inet_upstream, sizeof(ngx_inet_upstream_t)); 2020 ngx_memzero(&inet_upstream, sizeof(ngx_inet_upstream_t));
2018 2021
2019 inet_upstream.name = *url; 2022 inet_upstream.name = *url;
2020 inet_upstream.url.len = url->len - add; 2023 inet_upstream.url.len = url->len - add;
2021 inet_upstream.url.data = url->data + add; 2024 inet_upstream.url.data = url->data + add;
2022 inet_upstream.default_port_value = 80; 2025 inet_upstream.default_port_value = port;
2023 inet_upstream.uri_part = 1; 2026 inet_upstream.uri_part = 1;
2024 2027
2025 plcf->peers = ngx_inet_upstream_parse(cf, &inet_upstream); 2028 plcf->peers = ngx_inet_upstream_parse(cf, &inet_upstream);
2026 if (plcf->peers == NULL) { 2029 if (plcf->peers == NULL) {
2027 return NGX_CONF_ERROR; 2030 return NGX_CONF_ERROR;
2030 plcf->host_header = inet_upstream.host_header; 2033 plcf->host_header = inet_upstream.host_header;
2031 plcf->port_text = inet_upstream.port_text; 2034 plcf->port_text = inet_upstream.port_text;
2032 plcf->upstream.uri = inet_upstream.uri; 2035 plcf->upstream.uri = inet_upstream.uri;
2033 } 2036 }
2034 2037
2035 plcf->upstream.schema.len = sizeof("http://") - 1; 2038 plcf->upstream.schema.len = add;
2036 plcf->upstream.schema.data = (u_char *) "http://"; 2039 plcf->upstream.schema.data = url->data;
2037 2040
2038 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); 2041 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
2039 2042
2040 clcf->handler = ngx_http_proxy_handler; 2043 clcf->handler = ngx_http_proxy_handler;
2041 2044