httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexei Kosut <ako...@hyperreal.com>
Subject cvs commit: apache/src mod_browser.c
Date Fri, 16 Aug 1996 23:15:21 GMT
akosut      96/08/16 16:15:20

  Modified:    src       mod_browser.c
  Log:
  Make some changes to mod_browser:
  
  Change BrowserCase to BrowserNoCase
  Let per-server entries add, instead of override.
  Add the ability to use !option to cancel a previously set option.
  
  Reviewed by: Jim Jagielski
  
  Revision  Changes    Path
  1.2       +24 -5     apache/src/mod_browser.c
  
  Index: mod_browser.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_browser.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -C3 -r1.1 -r1.2
  *** mod_browser.c	1996/08/12 18:59:45	1.1
  --- mod_browser.c	1996/08/16 23:15:19	1.2
  ***************
  *** 82,87 ****
  --- 82,97 ----
        return (void *)new;
    }
    
  + void *merge_browser_config (pool *p, void *basev, void *overridesv)
  + {
  +     browser_server_config_rec *a =
  + 	pcalloc(p, sizeof(browser_server_config_rec));
  +     browser_server_config_rec *base = basev, *overrides = overridesv;
  + 
  +     a->browsers = append_arrays(p, base->browsers, overrides->browsers);
  +     return a;
  + }
  + 
    char *add_browser(cmd_parms *cmd, void *dummy, char *name, char *feature)
    {
        browser_server_config_rec *sconf =
  ***************
  *** 97,102 ****
  --- 107,113 ----
    	if (!strcmp(b->name, name)) {
    	    var = getword(cmd->pool, &feature, '=');
    	    if (*feature) table_set(b->features, var, feature);
  + 	    else if (*var == '!') table_set(b->features, var + 1, "!");
    	    else table_set(b->features, var, "1");
    	    return NULL;
    	}
  ***************
  *** 113,118 ****
  --- 124,130 ----
    
        var = getword(cmd->pool, &feature, '=');
        if (*feature) table_set(new->features, var, feature);
  +     else if (*var == '!') table_set(new->features, var + 1, "!");
        else table_set(new->features, var, "1");
    
        return NULL;
  ***************
  *** 121,127 ****
    command_rec browser_module_cmds[] = {
    { "BrowserMatch", add_browser, (void*)0,
        RSRC_CONF, ITERATE2, "A browser regex and a list of variables." },
  ! { "BrowserCase", add_browser, (void*)REG_ICASE,
        RSRC_CONF, ITERATE2, "a browser regex and a list of variables." },
    { NULL },
    };
  --- 133,139 ----
    command_rec browser_module_cmds[] = {
    { "BrowserMatch", add_browser, (void*)0,
        RSRC_CONF, ITERATE2, "A browser regex and a list of variables." },
  ! { "BrowserNoCase", add_browser, (void*)REG_ICASE,
        RSRC_CONF, ITERATE2, "a browser regex and a list of variables." },
    { NULL },
    };
  ***************
  *** 132,139 ****
        browser_server_config_rec *sconf = get_module_config (s->module_config,
    							  &browser_module);
        browser_entry *entries = (browser_entry *)sconf->browsers->elts;
        char *ua = table_get(r->headers_in, "User-Agent");
  !     int i;
    
        if (!ua) return DECLINED;
    
  --- 144,152 ----
        browser_server_config_rec *sconf = get_module_config (s->module_config,
    							  &browser_module);
        browser_entry *entries = (browser_entry *)sconf->browsers->elts;
  +     table_entry *elts;
        char *ua = table_get(r->headers_in, "User-Agent");
  !     int i, j;
    
        if (!ua) return DECLINED;
    
  ***************
  *** 141,148 ****
    	browser_entry *b = &entries[i];
    
    	if (!regexec(b->preg, ua, 0, NULL, 0)) {
  ! 	    r->subprocess_env = overlay_tables(r->pool, r->subprocess_env,
  ! 					       b->features);
    	}
        }
    
  --- 154,167 ----
    	browser_entry *b = &entries[i];
    
    	if (!regexec(b->preg, ua, 0, NULL, 0)) {
  ! 	    elts = (table_entry *)b->features->elts;
  ! 
  ! 	    for (j = 0; j < b->features->nelts; ++j) {
  ! 		if (!strcmp(elts[j].val, "!"))
  ! 		    table_unset(r->subprocess_env, elts[j].key);
  ! 		else
  ! 		    table_set(r->subprocess_env, elts[j].key, elts[j].val);
  ! 	    }
    	}
        }
    
  ***************
  *** 155,161 ****
       NULL,			/* dir config creater */
       NULL,			/* dir merger --- default is to override */
       create_browser_config,	/* server config */
  !    NULL,			/* merge server configs */
       browser_module_cmds,		/* command table */
       NULL,			/* handlers */
       NULL,			/* filename translation */
  --- 174,180 ----
       NULL,			/* dir config creater */
       NULL,			/* dir merger --- default is to override */
       create_browser_config,	/* server config */
  !    merge_browser_config,     	/* merge server configs */
       browser_module_cmds,		/* command table */
       NULL,			/* handlers */
       NULL,			/* filename translation */
  
  
  

Mime
View raw message