Commit f2353e13 authored by William A. Rowe Jr's avatar William A. Rowe Jr
Browse files

  sec, sec, who's got a sec?  This gave me a headache, but I had to clear
  out the last patch before I rearranged this to be _readable_.

  Next step for everyone's sanity, provide <Proxy > directives ;)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90646 13f79535-47bb-0310-9956-ffa450edef68
parent 0ee39364
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -461,7 +461,7 @@ typedef struct {
    int loglevel;
    
    /* Access control */
    apr_array_header_t *sec;
    apr_array_header_t *sec_file;
    regex_t *r;

#ifdef WIN32
@@ -490,7 +490,7 @@ typedef struct {
    /* Access control */

    char *access_name;
    apr_array_header_t *sec;
    apr_array_header_t *sec_dir;
    apr_array_header_t *sec_url;
} core_server_config;

+12 −12
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ static void *create_core_dir_config(apr_pool_t *a, char *dir)

    conf->limit_req_body = 0;
    conf->limit_xml_body = AP_LIMIT_UNSET;
    conf->sec = apr_array_make(a, 2, sizeof(ap_conf_vector_t *));
    conf->sec_file = apr_array_make(a, 2, sizeof(ap_conf_vector_t *));
#ifdef WIN32
    conf->script_interpreter_source = INTERPRETER_SOURCE_UNSET;
#endif
@@ -301,7 +301,7 @@ static void *merge_core_dir_configs(apr_pool_t *a, void *basev, void *newv)
    else
        conf->limit_xml_body = base->limit_xml_body;

    conf->sec = apr_array_append(a, base->sec, new->sec);
    conf->sec_file = apr_array_append(a, base->sec_file, new->sec_file);

    if (new->satisfy != SATISFY_NOSPEC) {
        conf->satisfy = new->satisfy;
@@ -342,7 +342,7 @@ static void *create_core_server_config(apr_pool_t *a, server_rec *s)
#endif
    conf->access_name = is_virtual ? NULL : DEFAULT_ACCESS_FNAME;
    conf->ap_document_root = is_virtual ? NULL : DOCUMENT_LOCATION;
    conf->sec = apr_array_make(a, 40, sizeof(ap_conf_vector_t *));
    conf->sec_dir = apr_array_make(a, 40, sizeof(ap_conf_vector_t *));
    conf->sec_url = apr_array_make(a, 40, sizeof(ap_conf_vector_t *));
    
    return (void *)conf;
@@ -362,7 +362,7 @@ static void *merge_core_server_configs(apr_pool_t *p, void *basev, void *virtv)
    if (!conf->ap_document_root) {
        conf->ap_document_root = base->ap_document_root;
    }
    conf->sec = apr_array_append(p, base->sec, virt->sec);
    conf->sec_dir = apr_array_append(p, base->sec_dir, virt->sec_dir);
    conf->sec_url = apr_array_append(p, base->sec_url, virt->sec_url);

    return conf;
@@ -376,7 +376,7 @@ AP_CORE_DECLARE(void) ap_add_per_dir_conf(server_rec *s, void *dir_config)
{
    core_server_config *sconf = ap_get_module_config(s->module_config,
						     &core_module);
    void **new_space = (void **)apr_array_push(sconf->sec);
    void **new_space = (void **)apr_array_push(sconf->sec_dir);
    
    *new_space = dir_config;
}
@@ -392,7 +392,7 @@ AP_CORE_DECLARE(void) ap_add_per_url_conf(server_rec *s, void *url_config)

AP_CORE_DECLARE(void) ap_add_file_conf(core_dir_config *conf, void *url_config)
{
    void **new_space = (void **)apr_array_push(conf->sec);
    void **new_space = (void **)apr_array_push(conf->sec_file);
    
    *new_space = url_config;
}
@@ -469,7 +469,7 @@ static int reorder_sorter(const void *va, const void *vb)
void ap_core_reorder_directories(apr_pool_t *p, server_rec *s)
{
    core_server_config *sconf;
    apr_array_header_t *sec;
    apr_array_header_t *sec_dir;
    struct reorder_sort_rec *sortbin;
    int nelts;
    ap_conf_vector_t **elts;
@@ -477,13 +477,13 @@ void ap_core_reorder_directories(apr_pool_t *p, server_rec *s)
    apr_pool_t *tmp;

    sconf = ap_get_module_config(s->module_config, &core_module);
    sec = sconf->sec;
    nelts = sec->nelts;
    elts = (ap_conf_vector_t **)sec->elts;
    sec_dir = sconf->sec_dir;
    nelts = sec_dir->nelts;
    elts = (ap_conf_vector_t **)sec_dir->elts;

    /* we have to allocate tmp space to do a stable sort */
    apr_pool_create(&tmp, p);
    sortbin = apr_palloc(tmp, sec->nelts * sizeof(*sortbin));
    sortbin = apr_palloc(tmp, sec_dir->nelts * sizeof(*sortbin));
    for (i = 0; i < nelts; ++i) {
	sortbin[i].orig_index = i;
	sortbin[i].elt = elts[i];
@@ -1576,7 +1576,7 @@ static const char *dirsection(cmd_parms *cmd, void *mconfig, const char *arg)
    }
    else if (!strcmp(cmd->path, "~")) {
	cmd->path = ap_getword_conf(cmd->pool, &arg);
        if (!cmd->path) {
        if (!cmd->path)
            return "<Directory ~ > block must specify a path";
	r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE);
    }
+19 −19
Original line number Diff line number Diff line
@@ -384,8 +384,8 @@ AP_DECLARE(int) directory_walk(request_rec *r)
    core_server_config *sconf = ap_get_module_config(r->server->module_config,
                                                     &core_module);
    ap_conf_vector_t *per_dir_defaults = r->server->lookup_defaults;
    ap_conf_vector_t **sec = (ap_conf_vector_t **) sconf->sec->elts;
    int num_sec = sconf->sec->nelts;
    ap_conf_vector_t **sec_dir = (ap_conf_vector_t **) sconf->sec_dir->elts;
    int num_sec = sconf->sec_dir->nelts;
    char *test_filename;
    char *test_dirname;
    int res;
@@ -428,7 +428,7 @@ AP_DECLARE(int) directory_walk(request_rec *r)

        for (j = 0; j < num_sec; ++j) {

            entry_config = sec[j];
            entry_config = sec_dir[j];
            entry_core = ap_get_module_config(entry_config, &core_module);
            entry_dir = entry_core->d;

@@ -588,7 +588,7 @@ AP_DECLARE(int) directory_walk(request_rec *r)
        for (; j < num_sec; ++j) {
            char *entry_dir;

            entry_config = sec[j];
            entry_config = sec_dir[j];
            entry_core = ap_get_module_config(entry_config, &core_module);
            entry_dir = entry_core->d;

@@ -650,7 +650,7 @@ AP_DECLARE(int) directory_walk(request_rec *r)
     */
    for (; j < num_sec; ++j) {

        entry_config = sec[j];
        entry_config = sec_dir[j];
        entry_core = ap_get_module_config(entry_config, &core_module);

        if (entry_core->r) {
@@ -704,9 +704,9 @@ AP_DECLARE(int) directory_walk(request_rec *r)
    core_server_config *sconf = ap_get_module_config(r->server->module_config,
                                                     &core_module);
    ap_conf_vector_t *per_dir_defaults = r->server->lookup_defaults;
    ap_conf_vector_t **sec_ent = (ap_conf_vector_t **) sconf->sec->elts;
    int num_sec = sconf->sec->nelts;
    int sec;
    ap_conf_vector_t **sec_ent = (ap_conf_vector_t **) sconf->sec_dir->elts;
    int num_sec = sconf->sec_dir->nelts;
    int sec_idx;
    unsigned int seg;
    int res;
    ap_conf_vector_t *entry_config;
@@ -767,9 +767,9 @@ AP_DECLARE(int) directory_walk(request_rec *r)
            return HTTP_FORBIDDEN;
        }

        for (sec = 0; sec < num_sec; ++sec) {
        for (sec_idx = 0; sec_idx < num_sec; ++sec_idx) {

            entry_config = sec_ent[sec];
            entry_config = sec_ent[sec_idx];
            entry_core = ap_get_module_config(entry_config, &core_module);
            entry_dir = entry_core->d;

@@ -802,11 +802,11 @@ AP_DECLARE(int) directory_walk(request_rec *r)

    /*
     * seg keeps track of which segment we've copied.
     * sec keeps track of which section we're on, since sections are
     * sec_idx keeps track of which section we're on, since sections are
     *     ordered by number of segments. See core_reorder_directories 
     */
    seg = ap_count_dirs(r->filename);
    sec = 0;
    sec_idx = 0;
    do {
        int overrides_here;
        core_dir_config *core_dir = ap_get_module_config(per_dir_defaults,
@@ -814,16 +814,16 @@ AP_DECLARE(int) directory_walk(request_rec *r)
        
        /* We have no trailing slash, but we sure would appreciate one...
         */
        if (!sec && r->filename[strlen(r->filename)-1] != '/')
        if (!sec_idx && r->filename[strlen(r->filename)-1] != '/')
            strcat(r->filename, "/");

        /* Begin *this* level by looking for matching <Directory> sections
         * from the server config.
         */
        for (; sec < num_sec; ++sec) {
        for (; sec_idx < num_sec; ++sec_idx) {
            const char *entry_dir;

            entry_config = sec_ent[sec];
            entry_config = sec_ent[sec_idx];
            entry_core = ap_get_module_config(entry_config, &core_module);
            entry_dir = entry_core->d;

@@ -994,9 +994,9 @@ AP_DECLARE(int) directory_walk(request_rec *r)
     * already handled the proxy:-style stuff.  Now we'll deal with the
     * regexes.
     */
    for (; sec < num_sec; ++sec) {
    for (; sec_idx < num_sec; ++sec_idx) {

        entry_config = sec_ent[sec];
        entry_config = sec_ent[sec_idx];
        entry_core = ap_get_module_config(entry_config, &core_module);

        if (entry_core->r) {
@@ -1111,8 +1111,8 @@ AP_DECLARE(int) file_walk(request_rec *r)
    core_dir_config *conf = ap_get_module_config(r->per_dir_config,
                                                 &core_module);
    ap_conf_vector_t *per_dir_defaults = r->per_dir_config;
    ap_conf_vector_t **file = (ap_conf_vector_t **) conf->sec->elts;
    int num_files = conf->sec->nelts;
    ap_conf_vector_t **file = (ap_conf_vector_t **) conf->sec_file->elts;
    int num_files = conf->sec_file->nelts;
    char *test_file;

    /* get the basename */