cvs commit: apache-1.3/src/modules/standard mod_setenvif.c

1999-06-04 Thread coar
coar99/06/04 11:40:01

  Modified:src  CHANGES
   htdocs/manual/mod mod_setenvif.html
   src/modules/standard mod_setenvif.c
  Log:
A minor enhancement to SetEnvIf*: allow it to test envariables
as well as request attributes.
  
  Revision  ChangesPath
  1.1371+3 -0  apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1370
  retrieving revision 1.1371
  diff -u -r1.1370 -r1.1371
  --- CHANGES   1999/06/04 18:30:16 1.1370
  +++ CHANGES   1999/06/04 18:39:57 1.1371
  @@ -1,5 +1,8 @@
   Changes with Apache 1.3.7
   
  +  *) Allow SetEnvIf[NoCase] to test environment variables as well
  + as header fields and request attributes.  [Ken Coar]
  +
 *) Fix mod_autoindex's handling of ScanHTMLTitles when file
content-types are "text/html;parameters".  PR#4524  [Ken Coar]
   
  
  
  
  1.7   +24 -4 apache-1.3/htdocs/manual/mod/mod_setenvif.html
  
  Index: mod_setenvif.html
  ===
  RCS file: /home/cvs/apache-1.3/htdocs/manual/mod/mod_setenvif.html,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- mod_setenvif.html 1999/05/19 13:26:06 1.6
  +++ mod_setenvif.html 1999/06/04 18:40:00 1.7
  @@ -261,7 +261,8 @@
  HREF="directive-dict.html#Compatibility"
  REL="Help"
 >Compatibility: Apache 1.3 and above; the
  -  Request_Protocol keyword is only available with 1.3.7 and later
  +  Request_Protocol keyword and environment-variable matching are only
  +  available with 1.3.7 and later
 
 
 The SetEnvIf directive defines environment variables
  @@ -299,15 +300,34 @@
 Host, User-Agent, and Referer.
 
 
  +  If the attribute name doesn't match any of the special keywords,
  +  nor any of the request's header field names, it is tested as the name
  +  of an environment variable in the list of those associated with the 
request.
  +  This allows SetEnvIf directives to test against the result
  +  of prior matches.
  +  
  +  
  +   Only those environment variables defined by earlier
  +   SetEnvIf[NoCase] directives are available for testing in
  +   this manner.  'Earlier' means that they were defined at a broader scope
  +   (such as server-wide) or previously in the current directive's
  +   scope.
  +  
  +  
 Example:
 
 
  -   SetEnvIf Request_URI "\.(gif)|(jpg)|(xbm)$" object_is_image
  +   SetEnvIf Request_URI "\.gif$" object_is_image=gif
  +   SetEnvIf Request_URI "\.jpg$" object_is_image=jpg
  +   SetEnvIf Request_URI "\.xbm$" object_is_image=xbm
  +:
  SetEnvIf Referer www\.mydomain\.com intra_site_referral
  +:
  +   SetEnvIf object_is_image xbm XBIT_PROCESSING=1
 
 
  -  The first will set the envariable object_is_image if the
  -  request was for an image file, and the second sets
  +  The first three will set the envariable object_is_image if the
  +  request was for an image file, and the fourth sets
 intra_site_referral if the referring page was somewhere
 on the www.mydomain.com Web site.
 
  
  
  
  1.29  +3 -0  apache-1.3/src/modules/standard/mod_setenvif.c
  
  Index: mod_setenvif.c
  ===
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_setenvif.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- mod_setenvif.c1999/05/21 12:16:24 1.28
  +++ mod_setenvif.c1999/06/04 18:40:00 1.29
  @@ -364,6 +364,9 @@
break;
case SPECIAL_NOT:
val = ap_table_get(r->headers_in, b->name);
  + if (val == NULL) {
  + val = ap_table_get(r->subprocess_env, b->name);
  + }
break;
}
   }
  
  
  


cvs commit: apache-1.3/src/modules/standard mod_setenvif.c mod_rewrite.c mod_include.c mod_alias.c

1999-05-21 Thread rse
rse 99/05/21 05:16:28

  Modified:src  CHANGES
   src/include httpd.h ap_mmn.h ap_compat.h
   src/main util.c http_request.c util_uri.c
   src/support httpd.exp
   src/modules/standard mod_setenvif.c mod_rewrite.c
mod_include.c mod_alias.c
  Log:
  Replace regexec() calls with calls to a new API stub function ap_regexec().
  This solves problems with DSO modules which use the regex library.
  
  Submitted by: Jens-Uwe Mager <[EMAIL PROTECTED]>, Ralf S. Engelschall
  Reviewed by: Ralf S. Engelschall
  
  Revision  ChangesPath
  1.1361+4 -0  apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1360
  retrieving revision 1.1361
  diff -u -r1.1360 -r1.1361
  --- CHANGES   1999/05/19 13:26:07 1.1360
  +++ CHANGES   1999/05/21 12:16:14 1.1361
  @@ -1,5 +1,9 @@
   Changes with Apache 1.3.7
   
  +  *) Replace regexec() calls with calls to a new API stub function
  + ap_regexec().  This solves problems with DSO modules which use the regex
  + library. [Jens-Uwe Mager <[EMAIL PROTECTED]>, Ralf S. Engelschall]
  +
 *) Add 'Request_Protocol' special keyword to mod_setenvif so that
environment variables can be set according to the protocol version
(e.g., HTTP/0.9 or HTTP/1.1) of the request.  [Ken Coar]
  
  
  
  1.277 +3 -1  apache-1.3/src/include/httpd.h
  
  Index: httpd.h
  ===
  RCS file: /home/cvs/apache-1.3/src/include/httpd.h,v
  retrieving revision 1.276
  retrieving revision 1.277
  diff -u -r1.276 -r1.277
  --- httpd.h   1999/03/23 00:36:33 1.276
  +++ httpd.h   1999/05/21 12:16:17 1.277
  @@ -968,8 +968,10 @@
   void os2pathname(char *path);
   #endif
   
  +API_EXPORT(int)ap_regexec(const regex_t *preg, const char *string,
  +  size_t nmatch, regmatch_t pmatch[], int 
eflags);
   API_EXPORT(char *) ap_pregsub(pool *p, const char *input, const char *source,
  -size_t nmatch, regmatch_t pmatch[]);
  +  size_t nmatch, regmatch_t pmatch[]);
   
   API_EXPORT(void) ap_content_type_tolower(char *);
   API_EXPORT(void) ap_str_tolower(char *);
  
  
  
  1.35  +2 -1  apache-1.3/src/include/ap_mmn.h
  
  Index: ap_mmn.h
  ===
  RCS file: /home/cvs/apache-1.3/src/include/ap_mmn.h,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- ap_mmn.h  1999/05/07 00:16:09 1.34
  +++ ap_mmn.h  1999/05/21 12:16:17 1.35
  @@ -217,12 +217,13 @@
* 19990320.1   - add ap_vrprintf()
* 19990320.2   - add cmd_parms.context, ap_set_config_vectors, 
*export ap_add_file_conf
  + * 19990521 - add ap_regexec()
*/
   
   #define MODULE_MAGIC_COOKIE 0x41503133UL /* "AP13" */
   
   #ifndef MODULE_MAGIC_NUMBER_MAJOR
  -#define MODULE_MAGIC_NUMBER_MAJOR 19990320
  +#define MODULE_MAGIC_NUMBER_MAJOR 19990521
   #endif
   #define MODULE_MAGIC_NUMBER_MINOR 2 /* 0...n */
   #define MODULE_MAGIC_NUMBER MODULE_MAGIC_NUMBER_MAJOR/* backward 
compat */
  
  
  
  1.18  +1 -0  apache-1.3/src/include/ap_compat.h
  
  Index: ap_compat.h
  ===
  RCS file: /home/cvs/apache-1.3/src/include/ap_compat.h,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ap_compat.h   1999/05/07 00:16:09 1.17
  +++ ap_compat.h   1999/05/21 12:16:18 1.18
  @@ -305,6 +305,7 @@
   #define rationalize_mtime  ap_rationalize_mtime
   #define read_configap_read_config
   #define read_request   ap_read_request
  +#define regexecap_regexec
   #define register_cleanup   ap_register_cleanup
   #define register_other_child   ap_register_other_child
   #define release_mutex  ap_release_mutex
  
  
  
  1.161 +13 -1 apache-1.3/src/main/util.c
  
  Index: util.c
  ===
  RCS file: /home/cvs/apache-1.3/src/main/util.c,v
  retrieving revision 1.160
  retrieving revision 1.161
  diff -u -r1.160 -r1.161
  --- util.c1999/04/21 18:25:44 1.160
  +++ util.c1999/05/21 12:16:21 1.161
  @@ -281,9 +281,21 @@
   return 0;
   }
   
  +/* 
  + * Apache stub function for the regex libraries regexec() to make sure the
  + * whole regex(3) API is available through the Apache (exported) namespace.
  + * This is especially important for the DSO situations of modules.
  + * DO NOT MAKE A MACRO OUT OF THIS FUNCTION!
  + */
  +API_EXPORT(int) ap_regexec(const regex_t *pr

cvs commit: apache-1.3/src/modules/standard mod_setenvif.c

1999-05-19 Thread coar
coar99/05/19 06:26:10

  Modified:.STATUS
   htdocs/manual/mod mod_setenvif.html
   src  CHANGES
   src/modules/standard mod_setenvif.c
  Log:
Allow SetEnvIf* to set things according to the protocol of
the request.
  
  Revision  ChangesPath
  1.688 +1 -5  apache-1.3/STATUS
  
  Index: STATUS
  ===
  RCS file: /home/cvs/apache-1.3/STATUS,v
  retrieving revision 1.687
  retrieving revision 1.688
  diff -u -r1.687 -r1.688
  --- STATUS1999/05/17 18:02:51 1.687
  +++ STATUS1999/05/19 13:26:03 1.688
  @@ -1,5 +1,5 @@
 1.3 STATUS:
  -  Last modified at [$Date: 1999/05/17 18:02:51 $]
  +  Last modified at [$Date: 1999/05/19 13:26:03 $]
   
   Release:
   
  @@ -132,10 +132,6 @@
   * Ronald Tschalär's major update of mod_digest
   Message-ID: <[EMAIL PROTECTED]>
   Status: Big change -- needs review.
  -
  -* Ken's patch to add the request protocol to things mod_setenvif can test
  - Message-ID: <[EMAIL PROTECTED]>
  - Status: Ken +1
   
   In progress:
   
  
  
  
  1.6   +6 -1  apache-1.3/htdocs/manual/mod/mod_setenvif.html
  
  Index: mod_setenvif.html
  ===
  RCS file: /home/cvs/apache-1.3/htdocs/manual/mod/mod_setenvif.html,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- mod_setenvif.html 1998/05/28 14:06:54 1.5
  +++ mod_setenvif.html 1999/05/19 13:26:06 1.6
  @@ -260,7 +260,8 @@
 Compatibility: Apache 1.3 and above
  +  >Compatibility: Apache 1.3 and above; the
  +  Request_Protocol keyword is only available with 1.3.7 and later
 
 
 The SetEnvIf directive defines environment variables
  @@ -284,6 +285,10 @@
  
  Request_Method - the name of the method being used
   (GET, POST, et cetera)
  +   
  +   Request_Protocol - the name and version of the protocol
  +with which the request was made (e.g., "HTTP/0.9", "HTTP/1.1",
  +etc.)
  
  Request_URI - the portion of the URL following the
   scheme and host portion
  
  
  
  1.1360+4 -0  apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1359
  retrieving revision 1.1360
  diff -u -r1.1359 -r1.1360
  --- CHANGES   1999/05/17 08:00:02 1.1359
  +++ CHANGES   1999/05/19 13:26:07 1.1360
  @@ -1,5 +1,9 @@
   Changes with Apache 1.3.7
   
  +  *) Add 'Request_Protocol' special keyword to mod_setenvif so that
  + environment variables can be set according to the protocol version
  + (e.g., HTTP/0.9 or HTTP/1.1) of the request.  [Ken Coar]
  +
 *) Add DSO support for OpenStep (Mach 4.2) platform.
[Ralf S. Engelschall, Rex Dieter <[EMAIL PROTECTED]>] PR#3997
   
  
  
  
  1.27  +8 -1  apache-1.3/src/modules/standard/mod_setenvif.c
  
  Index: mod_setenvif.c
  ===
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_setenvif.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- mod_setenvif.c1999/01/01 19:05:13 1.26
  +++ mod_setenvif.c1999/05/19 13:26:09 1.27
  @@ -125,7 +125,8 @@
   SPECIAL_REMOTE_HOST,
   SPECIAL_REMOTE_USER,
   SPECIAL_REQUEST_URI,
  -SPECIAL_REQUEST_METHOD
  +SPECIAL_REQUEST_METHOD,
  +SPECIAL_REQUEST_PROTOCOL
   };
   typedef struct {
   char *name; /* header name */
  @@ -241,6 +242,9 @@
else if (!strcasecmp(fname, "request_method")) {
new->special_type = SPECIAL_REQUEST_METHOD;
}
  + else if (!strcasecmp(fname, "request_protocol")) {
  + new->special_type = SPECIAL_REQUEST_PROTOCOL;
  + }
else {
new->special_type = SPECIAL_NOT;
}
  @@ -354,6 +358,9 @@
break;
case SPECIAL_REQUEST_METHOD:
val = r->method;
  + break;
  + case SPECIAL_REQUEST_PROTOCOL:
  + val = r->protocol;
break;
case SPECIAL_NOT:
val = ap_table_get(r->headers_in, b->name);
  
  
  


cvs commit: apache-1.3/src/modules/standard mod_setenvif.c

1998-07-10 Thread coar
coar98/07/10 05:58:56

  Modified:src  CHANGES
   src/modules/standard mod_setenvif.c
  Log:
Make mod_setenvif work like mod_rewrite - namely, let it use
"^$" to match missing fields.
  
  Revision  ChangesPath
  1.957 +3 -0  apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.956
  retrieving revision 1.957
  diff -u -r1.956 -r1.957
  --- CHANGES   1998/07/09 20:37:12 1.956
  +++ CHANGES   1998/07/10 12:58:54 1.957
  @@ -1,5 +1,8 @@
   Changes with Apache 1.3.1
   
  +  *) mod_setenvif (BrowserMatch* and friends) will now match a missing
  + field with "^$".  [Ken Coar]
  +
 *) Cache a proxied request in the event that the client cancels the
transfer, provided that the configured percentage of the file has
already been transfered. It works for http transfers only.  The 
  
  
  
  1.25  +10 -3 apache-1.3/src/modules/standard/mod_setenvif.c
  
  Index: mod_setenvif.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_setenvif.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- mod_setenvif.c1998/07/10 00:54:17 1.24
  +++ mod_setenvif.c1998/07/10 12:58:56 1.25
  @@ -163,7 +163,8 @@
   }
   
   /* any non-NULL magic constant will do... used to indicate if REG_ICASE 
should
  - * be used */
  + * be used
  + */
   #define ICASE_MAGIC  ((void *)(&setenvif_module))
   
   static const char *add_setenvif_core(cmd_parms *cmd, void *mconfig,
  @@ -360,8 +361,14 @@
}
   }
   
  -if (!val) {
  -continue;
  + /*
  +  * A NULL value indicates that the header field or special entity
  +  * wasn't present or is undefined.  Represent that as an empty string
  +  * so that REs like "^$" will work and allow envariable setting
  +  * based on missing or empty field.
  +  */
  +if (val == NULL) {
  +val = "";
   }
   
   if (!regexec(b->preg, val, 0, NULL, 0)) {
  
  
  


cvs commit: apache-1.3/src/modules/standard mod_setenvif.c

1998-07-10 Thread coar
coar98/07/09 17:54:18

  Modified:src/modules/standard mod_setenvif.c
  Log:
Yes, I know this is style-guide/indent stuff, but I'm tracking down
a possible bug and want to have a clean basis for any changes.  I.e.,
I'm not just being capricious..
  
  Revision  ChangesPath
  1.24  +31 -27apache-1.3/src/modules/standard/mod_setenvif.c
  
  Index: mod_setenvif.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_setenvif.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- mod_setenvif.c1998/06/27 18:09:33 1.23
  +++ mod_setenvif.c1998/07/10 00:54:17 1.24
  @@ -158,21 +158,21 @@
   sei_cfg_rec *base = basev, *overrides = overridesv;
   
   a->conditionals = ap_append_arrays(p, base->conditionals,
  -overrides->conditionals);
  +overrides->conditionals);
   return a;
   }
   
  -/* any non-NULL magic constant will do... used to indicate if REG_ICASE 
should be
  - * used */
  +/* any non-NULL magic constant will do... used to indicate if REG_ICASE 
should
  + * be used */
   #define ICASE_MAGIC  ((void *)(&setenvif_module))
   
   static const char *add_setenvif_core(cmd_parms *cmd, void *mconfig,
  -char *fname, const char *args)
  +  char *fname, const char *args)
   {
   char *regex;
   const char *feature;
   sei_cfg_rec *sconf = ap_get_module_config(cmd->server->module_config,
  -   &setenvif_module);
  +   &setenvif_module);
   sei_entry *new, *entries = (sei_entry *) sconf->conditionals->elts;
   char *var;
   int i;
  @@ -183,7 +183,7 @@
   regex = ap_getword_conf(cmd->pool, &args);
   if (!*regex) {
   return ap_pstrcat(cmd->pool, "Missing regular expression for ",
  -cmd->cmd->name, NULL);
  +   cmd->cmd->name, NULL);
   }
   
   /*
  @@ -217,11 +217,11 @@
new->regex = regex;
new->icase = icase;
new->preg = ap_pregcomp(cmd->pool, regex,
  - (REG_EXTENDED | REG_NOSUB
  - | (icase ? REG_ICASE : 0)));
  + (REG_EXTENDED | REG_NOSUB
  +  | (icase ? REG_ICASE : 0)));
if (new->preg == NULL) {
return ap_pstrcat(cmd->pool, cmd->cmd->name,
  - " regex could not be compiled.", NULL);
  +   " regex could not be compiled.", NULL);
}
new->features = ap_make_table(cmd->pool, 2);
   
  @@ -248,10 +248,11 @@
new = &entries[i];
   }
   
  -for (;;) {
  +for ( ; ; ) {
feature = ap_getword_conf(cmd->pool, &args);
  - if(!*feature)
  + if (!*feature) {
break;
  + }
   beenhere++;
   
   var = ap_getword(cmd->pool, &feature, '=');
  @@ -268,13 +269,14 @@
   
   if (!beenhere) {
   return ap_pstrcat(cmd->pool, "Missing envariable expression for ",
  -cmd->cmd->name, NULL);
  +   cmd->cmd->name, NULL);
   }
   
   return NULL;
   }
   
  -static const char *add_setenvif(cmd_parms *cmd, void *mconfig, const char 
*args)
  +static const char *add_setenvif(cmd_parms *cmd, void *mconfig,
  + const char *args)
   {
   char *fname;
   
  @@ -282,7 +284,7 @@
   fname = ap_getword_conf(cmd->pool, &args);
   if (!*fname) {
   return ap_pstrcat(cmd->pool, "Missing header-field name for ",
  -cmd->cmd->name, NULL);
  +   cmd->cmd->name, NULL);
   }
   return add_setenvif_core(cmd, mconfig, fname, args);
   }
  @@ -299,28 +301,30 @@
   
   static const command_rec setenvif_module_cmds[] =
   {
  -{"SetEnvIf", add_setenvif, NULL,
  - RSRC_CONF, RAW_ARGS, "A header-name, regex and a list of variables."},
  -{"SetEnvIfNoCase", add_setenvif, ICASE_MAGIC,
  - RSRC_CONF, RAW_ARGS, "a header-name, regex and a list of variables."},
  -{"BrowserMatch", add_browser, NULL,
  - RSRC_CONF, RAW_ARGS, "A browser regex and a list of variables."},
  -{"BrowserMatchNoCase", add_browser, ICASE_MAGIC,
  - RSRC_CONF, RAW_ARGS, "A browser regex and a list of variables."},
  -{NULL},
  +{ "SetEnvIf", add_setenvif, NULL,
  +  RSRC_CONF, RAW_ARGS, "A header-name, regex and a list of variables." },
  +{ "SetEnvIfNoCase", add_setenvif, ICASE_MAGIC,
  +  RSRC_CONF, RAW_ARGS, "a header-name, regex and a list of variables." },
  +{ "BrowserMatch", add_browser, NULL,
  +  RSRC_CONF, RAW_ARGS, "A browser regex and a list of variables." },
  +{ "BrowserMatchNoCase", add_browser, ICASE_MAGIC,
  +  RS

Re: cvs commit: apache-1.3/src/modules/standard mod_setenvif.c

1998-03-15 Thread Dean Gaudet


On 15 Mar 1998 [EMAIL PROTECTED] wrote:

>   - Perform more comparisons at compile-time in order to speed up things
> at compile-time.

Er, "perform more comparisons at config-time in order to speed up things
at run-time".

Dean



cvs commit: apache-1.3/src/modules/standard mod_setenvif.c

1998-03-15 Thread dgaudet
dgaudet 98/03/15 13:39:56

  Modified:htdocs/manual/mod mod_setenvif.html
   src  CHANGES
   src/modules/standard mod_setenvif.c
  Log:
  - The "merging" optimization in mod_setenvif did not deal with
SetEnvIfNoCase properly; and it used strcmp() to compare header
names when it should use strcasecmp().
  
  - Change the merging optimization so that it only considers the most
recent setenvif for merging.  This means that mod_setenvif will
consider all directives in the order they appear in the config file.
  
  - Document that mod_setenvif considers directives in the order they
appear, and give an example use.
  
  - Perform more comparisons at compile-time in order to speed up things
at compile-time.
  
  Revision  ChangesPath
  1.3   +10 -0 apache-1.3/htdocs/manual/mod/mod_setenvif.html
  
  Index: mod_setenvif.html
  ===
  RCS file: /export/home/cvs/apache-1.3/htdocs/manual/mod/mod_setenvif.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- mod_setenvif.html 1998/01/28 19:11:57 1.2
  +++ mod_setenvif.html 1998/03/15 21:39:50 1.3
  @@ -26,6 +26,16 @@
 regular expressions you specify.  These envariables can be used by
 other parts of the server to make decisions about actions to be taken.
 
  +  The directives are considered in the order they appear in the
  +  configuration files.  So more complex sequences can be used, such
  +  as this example, which sets netscape if the browser
  +  is mozilla but not MSIE.
  +  
  +  BrowserMatch ^Mozilla netscape
  +  BrowserMatch MSIE !netscape
  +  
  +  
  +
 Directives
 
  BrowserMatch
  
  
  
  1.712 +13 -1 apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.711
  retrieving revision 1.712
  diff -u -r1.711 -r1.712
  --- CHANGES   1998/03/14 16:25:44 1.711
  +++ CHANGES   1998/03/15 21:39:52 1.712
  @@ -1,5 +1,17 @@
   Changes with Apache 1.3b6
  -  
  +
  +  *) Clean up some undocumented behaviour of mod_setenvif related to
  + "merging" two SetEnvIf directives when they match the same header
  + and regex.  Document that mod_setenvif will perform comparisons in
  + the order they appear in the config file.  Optimize mod_setenvif by
  + doing more work at config time rather than at runtime.
  + [Dean Gaudet]
  +
  +  *) mod_setenvif would incorrectly merge a SetEnvIf and SetEnvIfNoCase (or
  + BrowserMatch and BrowserMatchNoCase) when they matched the same header
  + and regex.  Fix this; but also fix it so that this merging optimization
  + only happens
  +
 *) src/include/ap_config.h now wraps it's #define's with #ifndef/#endif's
to allow for modules to overrule them and to reduce redefinition
warnings [Jim Jagielski]
  
  
  
  1.19  +96 -37apache-1.3/src/modules/standard/mod_setenvif.c
  
  Index: mod_setenvif.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_setenvif.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- mod_setenvif.c1998/03/13 19:20:43 1.18
  +++ mod_setenvif.c1998/03/15 21:39:55 1.19
  @@ -115,11 +115,21 @@
   #include "http_core.h"
   #include "http_log.h"
   
  +enum special {
  +SPECIAL_NOT,
  +SPECIAL_REMOTE_ADDR,
  +SPECIAL_REMOTE_HOST,
  +SPECIAL_REMOTE_USER,
  +SPECIAL_REQUEST_URI,
  +SPECIAL_REQUEST_METHOD
  +};
   typedef struct {
   char *name; /* header name */
   char *regex;/* regex to match against */
   regex_t *preg;  /* compiled regex */
   table *features;/* env vars to set (or unset) */
  +enum special special_type : 4;   /* is it a "special" header ? */
  +unsigned icase : 1;  /* ignoring case? */
   } sei_entry;
   
   typedef struct {
  @@ -161,6 +171,7 @@
   char *var;
   int i;
   int beenhere = 0;
  +unsigned icase;
   
   /* get regex */
   regex = getword_conf(cmd->pool, &args);
  @@ -170,33 +181,68 @@
   }
   
   /*
  - * First, try to merge into an existing entry
  + * If we've already got a sei_entry with the same name we want to
  + * just copy the name pointer... so that later on we can compare
  + * two header names just by comparing the pointers.
*/
   
   for (i = 0; i < sconf->conditionals->nelts; ++i) {
   new = &entries[i];
  -if (!strcmp(new->name, fname) && !strcmp(new->regex, regex))
  - goto gotit;
  + if (!strcasecmp(new->name, fname)) {
  + fname = new->name;
  + break;
  + }
   }
   
  -/*
  - * If none was found, c

cvs commit: apache-1.3/src/modules/standard mod_setenvif.c

1998-02-23 Thread dgaudet
dgaudet 98/02/23 02:53:35

  Modified:src  CHANGES
   src/modules/standard mod_setenvif.c
  Log:
  BrowserMatch didn't handle spaces in the regex properly.  I redid Ronald's
  patch because it would have required proper quoting to work right.
  
  While I was in there I removed the need for the cmd->info cast, and cleaned
  up a few other things.
  
  PR:   1825
  Submitted by: Ronald Tschalaer <[EMAIL PROTECTED]>
  
  Revision  ChangesPath
  1.661 +3 -0  apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.660
  retrieving revision 1.661
  diff -u -r1.660 -r1.661
  --- CHANGES   1998/02/23 08:34:56 1.660
  +++ CHANGES   1998/02/23 10:53:27 1.661
  @@ -1,5 +1,8 @@
   Changes with Apache 1.3b6
   
  +  *) The mod_setenvif BrowserMatch backwards compatibility command did not
  + work properly with spaces in the regex.  [Ronald Tschalaer] PR#1825
  +
 *) Add new RewriteMap types: First, `rnd' which is equivalent to the `txt'
type but with a special post-processing for the looked-up value: It
parses it into alternatives according to `|' chars and then only one
  
  
  
  1.16  +35 -35apache-1.3/src/modules/standard/mod_setenvif.c
  
  Index: mod_setenvif.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_setenvif.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- mod_setenvif.c1998/01/31 15:34:50 1.15
  +++ mod_setenvif.c1998/02/23 10:53:31 1.16
  @@ -146,35 +146,27 @@
   return a;
   }
   
  -static const char *add_setenvif(cmd_parms *cmd, void *mconfig, const char 
*args)
  +/* any non-NULL magic constant will do... used to indicate if REG_ICASE 
should be
  + * used */
  +#define ICASE_MAGIC  ((void *)(&setenvif_module))
  +
  +static const char *add_setenvif_core(cmd_parms *cmd, void *mconfig,
  +char *fname, const char *args)
   {
  -char *fname;
   char *regex;
   const char *feature;
  -const char *cmdline = args;
   sei_cfg_rec *sconf = get_module_config(cmd->server->module_config,
  &setenvif_module);
   sei_entry *new, *entries = (sei_entry *) sconf->conditionals->elts;
   char *var;
   int i;
  -int cflags = (int) (long) cmd->info;
  -char *error;
   int beenhere = 0;
   
  -/*
  - * Pull in the invariant pieces from the command line.
  - */
  -fname = getword_conf(cmd->pool, &cmdline);
  -if (!*fname) {
  -error = pstrcat(cmd->pool, "Missing header-field name for ",
  -cmd->cmd->name, NULL);
  -return error;
  -}
  -regex = getword_conf(cmd->pool, &cmdline);
  +/* get regex */
  +regex = getword_conf(cmd->pool, &args);
   if (!*regex) {
  -error = pstrcat(cmd->pool, "Missing regular expression for ",
  +return pstrcat(cmd->pool, "Missing regular expression for ",
   cmd->cmd->name, NULL);
  -return error;
   }
   
   /*
  @@ -195,17 +187,17 @@
   new->name = fname;
   new->regex = regex;
   new->preg = pregcomp(cmd->pool, regex,
  - (REG_EXTENDED | REG_NOSUB | cflags));
  + (REG_EXTENDED | REG_NOSUB
  +  | (cmd->info == ICASE_MAGIC ? REG_ICASE : 0)));
   if (new->preg == NULL) {
  -error = pstrcat(cmd->pool, cmd->cmd->name,
  +return pstrcat(cmd->pool, cmd->cmd->name,
   " regex could not be compiled.", NULL);
  -return error;
   }
   new->features = make_table(cmd->pool, 5);
   
   gotit:
   for( ; ; ) {
  - feature = getword_conf(cmd->pool, &cmdline);
  + feature = getword_conf(cmd->pool, &args);
if(!*feature)
break;
   beenhere++;
  @@ -223,38 +215,46 @@
   }
   
   if (!beenhere) {
  -error = pstrcat(cmd->pool, "Missing envariable expression for ",
  +return pstrcat(cmd->pool, "Missing envariable expression for ",
   cmd->cmd->name, NULL);
  -return error;
   }
   
   return NULL;
   }
   
  +static const char *add_setenvif(cmd_parms *cmd, void *mconfig, const char 
*args)
  +{
  +char *fname;
  +
  +/* get header name */
  +fname = getword_conf(cmd->pool, &args);
  +if (!*fname) {
  +return pstrcat(cmd->pool, "Missing header-field name for ",
  +cmd->cmd->name, NULL);
  +}
  +return add_setenvif_core(cmd, mconfig, fname, args);
  +}
  +
   /*
* This routine handles the BrowserMatch* directives.  It simply turns around
* and feeds them, with the appropriate embellishments, to the 
general-purpose
* command 

cvs commit: apache-1.3/src/modules/standard mod_setenvif.c

1998-01-31 Thread ben
ben 98/01/31 07:34:51

  Modified:src/modules/standard mod_setenvif.c
  Log:
  Now that I've looked at it, I can't leave it like it was. Eliminate duplicate 
code,
  move invariants out of the loop.
  
  Revision  ChangesPath
  1.15  +28 -39apache-1.3/src/modules/standard/mod_setenvif.c
  
  Index: mod_setenvif.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_setenvif.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- mod_setenvif.c1998/01/31 14:38:23 1.14
  +++ mod_setenvif.c1998/01/31 15:34:50 1.15
  @@ -176,49 +176,40 @@
   cmd->cmd->name, NULL);
   return error;
   }
  +
  +/*
  + * First, try to merge into an existing entry
  + */
  +
  +for (i = 0; i < sconf->conditionals->nelts; ++i) {
  +new = &entries[i];
  +if (!strcmp(new->name, fname) && !strcmp(new->regex, regex))
  + goto gotit;
  +}
  +
  +/*
  + * If none was found, create a new entry
  + */
  +
  +new = push_array(sconf->conditionals);
  +new->name = fname;
  +new->regex = regex;
  +new->preg = pregcomp(cmd->pool, regex,
  + (REG_EXTENDED | REG_NOSUB | cflags));
  +if (new->preg == NULL) {
  +error = pstrcat(cmd->pool, cmd->cmd->name,
  +" regex could not be compiled.", NULL);
  +return error;
  +}
  +new->features = make_table(cmd->pool, 5);
  +
  +gotit:
   for( ; ; ) {
feature = getword_conf(cmd->pool, &cmdline);
if(!*feature)
break;
   beenhere++;
   
  -/*
  - * First, try to merge into an existing entry
  - */
  -
  -for (i = 0; i < sconf->conditionals->nelts; ++i) {
  -sei_entry *b = &entries[i];
  -if (!strcmp(b->name, fname) && !strcmp(b->regex, regex)) {
  -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");
  -}
  - goto next;
  -}
  -}
  -
  -/*
  - * If none was found, create a new entry
  - */
  -
  -new = push_array(sconf->conditionals);
  -new->name = fname;
  -new->regex = regex;
  -new->preg = pregcomp(cmd->pool, regex,
  - (REG_EXTENDED | REG_NOSUB | cflags));
  -if (new->preg == NULL) {
  -error = pstrcat(cmd->pool, cmd->cmd->name,
  -" regex could not be compiled.", NULL);
  -return error;
  -}
  -new->features = make_table(cmd->pool, 5);
  -
   var = getword(cmd->pool, &feature, '=');
   if (*feature) {
   table_set(new->features, var, feature);
  @@ -229,8 +220,6 @@
   else {
   table_set(new->features, var, "1");
   }
  -next:
  - continue;
   }
   
   if (!beenhere) {
  
  
  


cvs commit: apache-1.3/src/modules/standard mod_setenvif.c

1998-01-31 Thread ben
ben 98/01/31 06:38:24

  Modified:src/modules/standard mod_setenvif.c
  Log:
  Make setenvif terminate when it should, instead of by accident, and also
  correctly handle multiple env vars to be set. As a side-effect, eliminate
  an env var with a null name.
  
  Revision  ChangesPath
  1.14  +7 -2  apache-1.3/src/modules/standard/mod_setenvif.c
  
  Index: mod_setenvif.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_setenvif.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- mod_setenvif.c1998/01/26 19:50:24 1.13
  +++ mod_setenvif.c1998/01/31 14:38:23 1.14
  @@ -176,7 +176,10 @@
   cmd->cmd->name, NULL);
   return error;
   }
  -while ((feature = getword_conf(cmd->pool, &cmdline))) {
  +for( ; ; ) {
  + feature = getword_conf(cmd->pool, &cmdline);
  + if(!*feature)
  + break;
   beenhere++;
   
   /*
  @@ -196,7 +199,7 @@
   else {
   table_set(b->features, var, "1");
   }
  -return NULL;
  + goto next;
   }
   }
   
  @@ -226,6 +229,8 @@
   else {
   table_set(new->features, var, "1");
   }
  +next:
  + continue;
   }
   
   if (!beenhere) {