comparison src/http/ngx_http_core_module.c @ 70:8ad297c88dcb NGINX_0_1_35

nginx 0.1.35 *) Feature: the "working_directory" directive. *) Feature: the "port_in_redirect" directive. *) Bugfix: the segmentation fault was occurred if the backend response header was in several packets; bug appeared in 0.1.29. *) Bugfix: if more than 10 servers were configured or some server did not use the "listen" directive, then the segmentation fault was occurred on the start. *) Bugfix: the segmentation fault might occur if the response was bigger than the temporary file. *) Bugfix: nginx returned the 400 response on requests like "GET http://www.domain.com/uri HTTP/1.0"; bug appeared in 0.1.28.
author Igor Sysoev <http://sysoev.ru>
date Tue, 07 Jun 2005 00:00:00 +0400
parents 0790a8599248
children b31656313b59
comparison
equal deleted inserted replaced
69:cce7ea52608c 70:8ad297c88dcb
317 ngx_conf_set_flag_slot, 317 ngx_conf_set_flag_slot,
318 NGX_HTTP_LOC_CONF_OFFSET, 318 NGX_HTTP_LOC_CONF_OFFSET,
319 offsetof(ngx_http_core_loc_conf_t, reset_timedout_connection), 319 offsetof(ngx_http_core_loc_conf_t, reset_timedout_connection),
320 NULL }, 320 NULL },
321 321
322 { ngx_string("port_in_redirect"),
323 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
324 ngx_conf_set_flag_slot,
325 NGX_HTTP_LOC_CONF_OFFSET,
326 offsetof(ngx_http_core_loc_conf_t, port_in_redirect),
327 NULL },
328
322 { ngx_string("msie_padding"), 329 { ngx_string("msie_padding"),
323 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, 330 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
324 ngx_conf_set_flag_slot, 331 ngx_conf_set_flag_slot,
325 NGX_HTTP_LOC_CONF_OFFSET, 332 NGX_HTTP_LOC_CONF_OFFSET,
326 offsetof(ngx_http_core_loc_conf_t, msie_padding), 333 offsetof(ngx_http_core_loc_conf_t, msie_padding),
1111 1118
1112 1119
1113 static char * 1120 static char *
1114 ngx_http_core_server(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy) 1121 ngx_http_core_server(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
1115 { 1122 {
1116 int m;
1117 char *rv; 1123 char *rv;
1118 void *mconf; 1124 void *mconf;
1119 ngx_conf_t save; 1125 ngx_uint_t m;
1126 ngx_conf_t pcf;
1120 ngx_http_module_t *module; 1127 ngx_http_module_t *module;
1121 ngx_http_conf_ctx_t *ctx, *http_ctx; 1128 ngx_http_conf_ctx_t *ctx, *http_ctx;
1122 ngx_http_core_srv_conf_t *cscf, **cscfp; 1129 ngx_http_core_srv_conf_t *cscf, **cscfp;
1123 ngx_http_core_main_conf_t *cmcf; 1130 ngx_http_core_main_conf_t *cmcf;
1124 1131
1187 *cscfp = cscf; 1194 *cscfp = cscf;
1188 1195
1189 1196
1190 /* parse inside server{} */ 1197 /* parse inside server{} */
1191 1198
1192 save = *cf; 1199 pcf = *cf;
1193 cf->ctx = ctx; 1200 cf->ctx = ctx;
1194 cf->cmd_type = NGX_HTTP_SRV_CONF; 1201 cf->cmd_type = NGX_HTTP_SRV_CONF;
1195 1202
1196 rv = ngx_conf_parse(cf, NULL); 1203 rv = ngx_conf_parse(cf, NULL);
1197 1204
1198 *cf = save; 1205 *cf = pcf;
1199 1206
1200 if (rv != NGX_CONF_OK) { 1207 if (rv != NGX_CONF_OK) {
1201 return rv; 1208 return rv;
1202 } 1209 }
1203 1210
1620 #else 1627 #else
1621 /* STUB: getuid() should be cached */ 1628 /* STUB: getuid() should be cached */
1622 ls->port = (getuid() == 0) ? 80 : 8000; 1629 ls->port = (getuid() == 0) ? 80 : 8000;
1623 #endif 1630 #endif
1624 ls->family = AF_INET; 1631 ls->family = AF_INET;
1632 ls->default_server = 0;
1625 } 1633 }
1626 1634
1627 if (conf->server_names.nelts == 0) { 1635 if (conf->server_names.nelts == 0) {
1628 sn = ngx_array_push(&conf->server_names); 1636 sn = ngx_array_push(&conf->server_names);
1629 if (sn == NULL) { 1637 if (sn == NULL) {
1724 lcf->keepalive_timeout = NGX_CONF_UNSET_MSEC; 1732 lcf->keepalive_timeout = NGX_CONF_UNSET_MSEC;
1725 lcf->keepalive_header = NGX_CONF_UNSET; 1733 lcf->keepalive_header = NGX_CONF_UNSET;
1726 lcf->lingering_time = NGX_CONF_UNSET_MSEC; 1734 lcf->lingering_time = NGX_CONF_UNSET_MSEC;
1727 lcf->lingering_timeout = NGX_CONF_UNSET_MSEC; 1735 lcf->lingering_timeout = NGX_CONF_UNSET_MSEC;
1728 lcf->reset_timedout_connection = NGX_CONF_UNSET; 1736 lcf->reset_timedout_connection = NGX_CONF_UNSET;
1737 lcf->port_in_redirect = NGX_CONF_UNSET;
1729 lcf->msie_padding = NGX_CONF_UNSET; 1738 lcf->msie_padding = NGX_CONF_UNSET;
1730 1739
1731 return lcf; 1740 return lcf;
1732 } 1741 }
1733 1742
1837 NGX_HTTP_CLIENT_TEMP_PATH, 0, 0, 0, 1846 NGX_HTTP_CLIENT_TEMP_PATH, 0, 0, 0,
1838 ngx_garbage_collector_temp_handler, cf); 1847 ngx_garbage_collector_temp_handler, cf);
1839 1848
1840 ngx_conf_merge_value(conf->reset_timedout_connection, 1849 ngx_conf_merge_value(conf->reset_timedout_connection,
1841 prev->reset_timedout_connection, 0); 1850 prev->reset_timedout_connection, 0);
1851 ngx_conf_merge_value(conf->port_in_redirect, prev->port_in_redirect, 1);
1842 ngx_conf_merge_value(conf->msie_padding, prev->msie_padding, 1); 1852 ngx_conf_merge_value(conf->msie_padding, prev->msie_padding, 1);
1843 1853
1844 if (conf->open_files == NULL) { 1854 if (conf->open_files == NULL) {
1845 conf->open_files = prev->open_files; 1855 conf->open_files = prev->open_files;
1846 } 1856 }
1855 ngx_http_core_srv_conf_t *scf = conf; 1865 ngx_http_core_srv_conf_t *scf = conf;
1856 1866
1857 u_char *addr; 1867 u_char *addr;
1858 ngx_int_t port; 1868 ngx_int_t port;
1859 ngx_uint_t p; 1869 ngx_uint_t p;
1870 ngx_str_t *args;
1860 struct hostent *h; 1871 struct hostent *h;
1861 ngx_str_t *args;
1862 ngx_http_listen_t *ls; 1872 ngx_http_listen_t *ls;
1863 1873
1864 /* 1874 /*
1865 * TODO: check duplicate 'listen' directives, 1875 * TODO: check duplicate 'listen' directives,
1866 * add resolved name to server names ??? 1876 * add resolved name to server names ???
1872 } 1882 }
1873 1883
1874 /* AF_INET only */ 1884 /* AF_INET only */
1875 1885
1876 ls->family = AF_INET; 1886 ls->family = AF_INET;
1877 ls->default_server = 0;
1878 ls->file_name = cf->conf_file->file.name; 1887 ls->file_name = cf->conf_file->file.name;
1879 ls->line = cf->conf_file->line; 1888 ls->line = cf->conf_file->line;
1889 ls->default_server = 0;
1880 1890
1881 args = cf->args->elts; 1891 args = cf->args->elts;
1882 addr = args[1].data; 1892 addr = args[1].data;
1883 1893
1884 for (p = 0; p < args[1].len; p++) { 1894 for (p = 0; p < args[1].len; p++) {