comparison src/http/ngx_http_core_module.c @ 310:95d92ec39071 NGINX_0_5_25

nginx 0.5.25 *) Bugfix: nginx could not be built with the --without-http_rewrite_module parameter; bug appeared in 0.5.24.
author Igor Sysoev <http://sysoev.ru>
date Mon, 11 Jun 2007 00:00:00 +0400
parents 94e16de3c33f
children 429900ca25ee
comparison
equal deleted inserted replaced
309:638a3e67d37d 310:95d92ec39071
1550 static char * 1550 static char *
1551 ngx_http_core_server(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy) 1551 ngx_http_core_server(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
1552 { 1552 {
1553 char *rv; 1553 char *rv;
1554 void *mconf; 1554 void *mconf;
1555 ngx_uint_t i, m; 1555 ngx_uint_t i;
1556 ngx_conf_t pcf; 1556 ngx_conf_t pcf;
1557 ngx_http_module_t *module; 1557 ngx_http_module_t *module;
1558 ngx_http_conf_ctx_t *ctx, *http_ctx; 1558 ngx_http_conf_ctx_t *ctx, *http_ctx;
1559 ngx_http_core_srv_conf_t *cscf, **cscfp; 1559 ngx_http_core_srv_conf_t *cscf, **cscfp;
1560 ngx_http_core_main_conf_t *cmcf;
1561 #if (NGX_PCRE)
1560 ngx_http_core_loc_conf_t **clcfp; 1562 ngx_http_core_loc_conf_t **clcfp;
1561 ngx_http_core_main_conf_t *cmcf; 1563 #endif
1562 1564
1563 ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)); 1565 ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t));
1564 if (ctx == NULL) { 1566 if (ctx == NULL) {
1565 return NGX_CONF_ERROR; 1567 return NGX_CONF_ERROR;
1566 } 1568 }
1580 ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module); 1582 ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module);
1581 if (ctx->loc_conf == NULL) { 1583 if (ctx->loc_conf == NULL) {
1582 return NGX_CONF_ERROR; 1584 return NGX_CONF_ERROR;
1583 } 1585 }
1584 1586
1585 for (m = 0; ngx_modules[m]; m++) { 1587 for (i = 0; ngx_modules[i]; i++) {
1586 if (ngx_modules[m]->type != NGX_HTTP_MODULE) { 1588 if (ngx_modules[i]->type != NGX_HTTP_MODULE) {
1587 continue; 1589 continue;
1588 } 1590 }
1589 1591
1590 module = ngx_modules[m]->ctx; 1592 module = ngx_modules[i]->ctx;
1591 1593
1592 if (module->create_srv_conf) { 1594 if (module->create_srv_conf) {
1593 mconf = module->create_srv_conf(cf); 1595 mconf = module->create_srv_conf(cf);
1594 if (mconf == NULL) { 1596 if (mconf == NULL) {
1595 return NGX_CONF_ERROR; 1597 return NGX_CONF_ERROR;
1596 } 1598 }
1597 1599
1598 ctx->srv_conf[ngx_modules[m]->ctx_index] = mconf; 1600 ctx->srv_conf[ngx_modules[i]->ctx_index] = mconf;
1599 } 1601 }
1600 1602
1601 if (module->create_loc_conf) { 1603 if (module->create_loc_conf) {
1602 mconf = module->create_loc_conf(cf); 1604 mconf = module->create_loc_conf(cf);
1603 if (mconf == NULL) { 1605 if (mconf == NULL) {
1604 return NGX_CONF_ERROR; 1606 return NGX_CONF_ERROR;
1605 } 1607 }
1606 1608
1607 ctx->loc_conf[ngx_modules[m]->ctx_index] = mconf; 1609 ctx->loc_conf[ngx_modules[i]->ctx_index] = mconf;
1608 } 1610 }
1609 } 1611 }
1610 1612
1611 1613
1612 /* the server configuration context */ 1614 /* the server configuration context */
1639 return rv; 1641 return rv;
1640 } 1642 }
1641 1643
1642 ngx_sort(cscf->locations.elts, (size_t) cscf->locations.nelts, 1644 ngx_sort(cscf->locations.elts, (size_t) cscf->locations.nelts,
1643 sizeof(ngx_http_core_loc_conf_t *), ngx_http_core_cmp_locations); 1645 sizeof(ngx_http_core_loc_conf_t *), ngx_http_core_cmp_locations);
1646
1647 #if (NGX_PCRE)
1644 1648
1645 cscf->regex_start = cscf->locations.nelts; 1649 cscf->regex_start = cscf->locations.nelts;
1646 clcfp = cscf->locations.elts; 1650 clcfp = cscf->locations.elts;
1647 1651
1648 for (i = 0; i < cscf->locations.nelts; i++) { 1652 for (i = 0; i < cscf->locations.nelts; i++) {
1650 cscf->regex_start = i; 1654 cscf->regex_start = i;
1651 break; 1655 break;
1652 } 1656 }
1653 } 1657 }
1654 1658
1659 #endif
1660
1655 return rv; 1661 return rv;
1656 } 1662 }
1657 1663
1658 1664
1659 static char * 1665 static char *
1660 ngx_http_core_location(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy) 1666 ngx_http_core_location(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
1661 { 1667 {
1662 char *rv; 1668 char *rv;
1663 ngx_uint_t i, m; 1669 ngx_uint_t i;
1664 ngx_str_t *value; 1670 ngx_str_t *value;
1665 ngx_conf_t save; 1671 ngx_conf_t save;
1666 ngx_http_module_t *module; 1672 ngx_http_module_t *module;
1667 ngx_http_conf_ctx_t *ctx, *pctx; 1673 ngx_http_conf_ctx_t *ctx, *pctx;
1668 ngx_http_core_srv_conf_t *cscf; 1674 ngx_http_core_srv_conf_t *cscf;
1684 ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module); 1690 ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module);
1685 if (ctx->loc_conf == NULL) { 1691 if (ctx->loc_conf == NULL) {
1686 return NGX_CONF_ERROR; 1692 return NGX_CONF_ERROR;
1687 } 1693 }
1688 1694
1689 for (m = 0; ngx_modules[m]; m++) { 1695 for (i = 0; ngx_modules[i]; i++) {
1690 if (ngx_modules[m]->type != NGX_HTTP_MODULE) { 1696 if (ngx_modules[i]->type != NGX_HTTP_MODULE) {
1691 continue; 1697 continue;
1692 } 1698 }
1693 1699
1694 module = ngx_modules[m]->ctx; 1700 module = ngx_modules[i]->ctx;
1695 1701
1696 if (module->create_loc_conf) { 1702 if (module->create_loc_conf) {
1697 ctx->loc_conf[ngx_modules[m]->ctx_index] = 1703 ctx->loc_conf[ngx_modules[i]->ctx_index] =
1698 module->create_loc_conf(cf); 1704 module->create_loc_conf(cf);
1699 if (ctx->loc_conf[ngx_modules[m]->ctx_index] == NULL) { 1705 if (ctx->loc_conf[ngx_modules[i]->ctx_index] == NULL) {
1700 return NGX_CONF_ERROR; 1706 return NGX_CONF_ERROR;
1701 } 1707 }
1702 } 1708 }
1703 } 1709 }
1704 1710
1826 } 1832 }
1827 1833
1828 ngx_sort(clcf->locations->elts, (size_t) clcf->locations->nelts, 1834 ngx_sort(clcf->locations->elts, (size_t) clcf->locations->nelts,
1829 sizeof(ngx_http_core_loc_conf_t *), ngx_http_core_cmp_locations); 1835 sizeof(ngx_http_core_loc_conf_t *), ngx_http_core_cmp_locations);
1830 1836
1837 #if (NGX_PCRE)
1838
1831 clcf->regex_start = clcf->locations->nelts; 1839 clcf->regex_start = clcf->locations->nelts;
1832 clcfp = clcf->locations->elts; 1840 clcfp = clcf->locations->elts;
1833 1841
1834 for (i = 0; i < clcf->locations->nelts; i++) { 1842 for (i = 0; i < clcf->locations->nelts; i++) {
1835 if (clcfp[i]->regex) { 1843 if (clcfp[i]->regex) {
1836 clcf->regex_start = i; 1844 clcf->regex_start = i;
1837 break; 1845 break;
1838 } 1846 }
1839 } 1847 }
1848
1849 #endif
1840 1850
1841 return rv; 1851 return rv;
1842 } 1852 }
1843 1853
1844 1854