comparison src/http/ngx_http_core_module.c @ 501:98143f74eb3d NGINX_0_7_58

nginx 0.7.58 *) Feature: a "listen" directive of the mail proxy module supports IPv6. *) Feature: the "image_filter_jpeg_quality" directive. *) Feature: the "client_body_in_single_buffer" directive. *) Feature: the $request_body variable. *) Bugfix: in ngx_http_autoindex_module in file name links having a ":" symbol in the name. *) Bugfix: "make upgrade" procedure did not work; the bug had appeared in 0.7.53. Thanks to Denis F. Latypoff.
author Igor Sysoev <http://sysoev.ru>
date Mon, 18 May 2009 00:00:00 +0400
parents 829f9a66a659
children 499474178a11
comparison
equal deleted inserted replaced
500:bb2281a3edb6 501:98143f74eb3d
353 NGX_HTTP_LOC_CONF_OFFSET, 353 NGX_HTTP_LOC_CONF_OFFSET,
354 offsetof(ngx_http_core_loc_conf_t, client_body_temp_path), 354 offsetof(ngx_http_core_loc_conf_t, client_body_temp_path),
355 NULL }, 355 NULL },
356 356
357 { ngx_string("client_body_in_file_only"), 357 { ngx_string("client_body_in_file_only"),
358 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, 358 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
359 ngx_conf_set_enum_slot, 359 ngx_conf_set_enum_slot,
360 NGX_HTTP_LOC_CONF_OFFSET, 360 NGX_HTTP_LOC_CONF_OFFSET,
361 offsetof(ngx_http_core_loc_conf_t, client_body_in_file_only), 361 offsetof(ngx_http_core_loc_conf_t, client_body_in_file_only),
362 &ngx_http_core_request_body_in_file }, 362 &ngx_http_core_request_body_in_file },
363
364 { ngx_string("client_body_in_single_buffer"),
365 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
366 ngx_conf_set_flag_slot,
367 NGX_HTTP_LOC_CONF_OFFSET,
368 offsetof(ngx_http_core_loc_conf_t, client_body_in_single_buffer),
369 NULL },
363 370
364 { ngx_string("sendfile"), 371 { ngx_string("sendfile"),
365 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF 372 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
366 |NGX_CONF_TAKE1, 373 |NGX_CONF_TAKE1,
367 ngx_conf_set_flag_slot, 374 ngx_conf_set_flag_slot,
1315 1322
1316 } else { 1323 } else {
1317 r->request_body_file_log_level = NGX_LOG_WARN; 1324 r->request_body_file_log_level = NGX_LOG_WARN;
1318 } 1325 }
1319 1326
1327 r->request_body_in_single_buf = clcf->client_body_in_single_buffer;
1328
1320 if (r->keepalive && clcf->keepalive_timeout == 0) { 1329 if (r->keepalive && clcf->keepalive_timeout == 0) {
1321 r->keepalive = 0; 1330 r->keepalive = 0;
1322 } 1331 }
1323 1332
1324 if (!clcf->tcp_nopush) { 1333 if (!clcf->tcp_nopush) {
1812 1821
1813 r->headers_in.user.len = len; 1822 r->headers_in.user.len = len;
1814 r->headers_in.user.data = auth.data; 1823 r->headers_in.user.data = auth.data;
1815 r->headers_in.passwd.len = auth.len - len - 1; 1824 r->headers_in.passwd.len = auth.len - len - 1;
1816 r->headers_in.passwd.data = &auth.data[len + 1]; 1825 r->headers_in.passwd.data = &auth.data[len + 1];
1817
1818 return NGX_OK;
1819 }
1820
1821
1822 ngx_int_t
1823 ngx_http_server_addr(ngx_http_request_t *r, ngx_str_t *s)
1824 {
1825 socklen_t len;
1826 ngx_uint_t addr;
1827 ngx_connection_t *c;
1828 u_char sa[NGX_SOCKADDRLEN];
1829 struct sockaddr_in *sin;
1830 #if (NGX_HAVE_INET6)
1831 ngx_uint_t i;
1832 struct sockaddr_in6 *sin6;
1833 #endif
1834
1835 c = r->connection;
1836
1837 switch (c->local_sockaddr->sa_family) {
1838
1839 #if (NGX_HAVE_INET6)
1840 case AF_INET6:
1841 sin6 = (struct sockaddr_in6 *) c->local_sockaddr;
1842
1843 for (addr = 0, i = 0; addr == 0 && i < 16; i++) {
1844 addr |= sin6->sin6_addr.s6_addr[i];
1845 }
1846
1847 break;
1848 #endif
1849
1850 default: /* AF_INET */
1851 sin = (struct sockaddr_in *) c->local_sockaddr;
1852 addr = sin->sin_addr.s_addr;
1853 break;
1854 }
1855
1856 if (addr == 0) {
1857
1858 len = NGX_SOCKADDRLEN;
1859
1860 if (getsockname(c->fd, (struct sockaddr *) &sa, &len) == -1) {
1861 ngx_connection_error(c, ngx_socket_errno, "getsockname() failed");
1862 return NGX_ERROR;
1863 }
1864
1865 c->local_sockaddr = ngx_palloc(r->connection->pool, len);
1866 if (c->local_sockaddr == NULL) {
1867 return NGX_ERROR;
1868 }
1869
1870 c->local_socklen = len;
1871 ngx_memcpy(c->local_sockaddr, &sa, len);
1872 }
1873
1874 if (s == NULL) {
1875 return NGX_OK;
1876 }
1877
1878 s->len = ngx_sock_ntop(c->local_sockaddr, s->data, s->len, 0);
1879 1826
1880 return NGX_OK; 1827 return NGX_OK;
1881 } 1828 }
1882 1829
1883 1830
2951 lcf->client_max_body_size = NGX_CONF_UNSET; 2898 lcf->client_max_body_size = NGX_CONF_UNSET;
2952 lcf->client_body_buffer_size = NGX_CONF_UNSET_SIZE; 2899 lcf->client_body_buffer_size = NGX_CONF_UNSET_SIZE;
2953 lcf->client_body_timeout = NGX_CONF_UNSET_MSEC; 2900 lcf->client_body_timeout = NGX_CONF_UNSET_MSEC;
2954 lcf->satisfy = NGX_CONF_UNSET_UINT; 2901 lcf->satisfy = NGX_CONF_UNSET_UINT;
2955 lcf->if_modified_since = NGX_CONF_UNSET_UINT; 2902 lcf->if_modified_since = NGX_CONF_UNSET_UINT;
2903 lcf->client_body_in_file_only = NGX_CONF_UNSET_UINT;
2904 lcf->client_body_in_single_buffer = NGX_CONF_UNSET;
2956 lcf->internal = NGX_CONF_UNSET; 2905 lcf->internal = NGX_CONF_UNSET;
2957 lcf->client_body_in_file_only = NGX_CONF_UNSET;
2958 lcf->sendfile = NGX_CONF_UNSET; 2906 lcf->sendfile = NGX_CONF_UNSET;
2959 lcf->sendfile_max_chunk = NGX_CONF_UNSET_SIZE; 2907 lcf->sendfile_max_chunk = NGX_CONF_UNSET_SIZE;
2960 lcf->directio = NGX_CONF_UNSET; 2908 lcf->directio = NGX_CONF_UNSET;
2961 lcf->tcp_nopush = NGX_CONF_UNSET; 2909 lcf->tcp_nopush = NGX_CONF_UNSET;
2962 lcf->tcp_nodelay = NGX_CONF_UNSET; 2910 lcf->tcp_nodelay = NGX_CONF_UNSET;
3142 3090
3143 ngx_conf_merge_uint_value(conf->satisfy, prev->satisfy, 3091 ngx_conf_merge_uint_value(conf->satisfy, prev->satisfy,
3144 NGX_HTTP_SATISFY_ALL); 3092 NGX_HTTP_SATISFY_ALL);
3145 ngx_conf_merge_uint_value(conf->if_modified_since, prev->if_modified_since, 3093 ngx_conf_merge_uint_value(conf->if_modified_since, prev->if_modified_since,
3146 NGX_HTTP_IMS_EXACT); 3094 NGX_HTTP_IMS_EXACT);
3095 ngx_conf_merge_uint_value(conf->client_body_in_file_only,
3096 prev->client_body_in_file_only, 0);
3097 ngx_conf_merge_value(conf->client_body_in_single_buffer,
3098 prev->client_body_in_single_buffer, 0);
3147 ngx_conf_merge_value(conf->internal, prev->internal, 0); 3099 ngx_conf_merge_value(conf->internal, prev->internal, 0);
3148 ngx_conf_merge_value(conf->client_body_in_file_only,
3149 prev->client_body_in_file_only, 0);
3150 ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0); 3100 ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0);
3151 ngx_conf_merge_size_value(conf->sendfile_max_chunk, 3101 ngx_conf_merge_size_value(conf->sendfile_max_chunk,
3152 prev->sendfile_max_chunk, 0); 3102 prev->sendfile_max_chunk, 0);
3153 ngx_conf_merge_off_value(conf->directio, prev->directio, 3103 ngx_conf_merge_off_value(conf->directio, prev->directio,
3154 NGX_MAX_OFF_T_VALUE); 3104 NGX_MAX_OFF_T_VALUE);