You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by be...@locus.apache.org on 2000/06/17 23:37:05 UTC

cvs commit: apache-2.0/src/modules/standard mod_mime.c

ben         00/06/17 14:37:05

  Modified:    src/include http_config.h
               src/main http_config.c
               src/modules/standard mod_mime.c
  Log:
  More command handlers.
  
  Revision  Changes    Path
  1.35      +4 -1      apache-2.0/src/include/http_config.h
  
  Index: http_config.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/http_config.h,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- http_config.h	2000/06/17 16:53:50	1.34
  +++ http_config.h	2000/06/17 21:37:02	1.35
  @@ -131,6 +131,8 @@
       { directive, { .take2=func }, mconfig, where, TAKE2, help }
   # define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
       { directive, { .take2=func }, mconfig, where, TAKE12, help }
  +# define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
  +    { directive, { .take2=func }, mconfig, where, ITERATE2, help }
   # define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
       { directive, { .take3=func }, mconfig, where, TAKE23, help }
   # define AP_INIT_FLAG(directive, func, mconfig, where, help) \
  @@ -366,7 +368,8 @@
   
   API_EXPORT_NONSTD(const char *) ap_set_string_slot(cmd_parms *, void *,
   						   const char *);
  -API_EXPORT_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *, char *, char *);
  +API_EXPORT_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *, 
  +							 void *, const char *);
   API_EXPORT_NONSTD(const char *) ap_set_flag_slot(cmd_parms *, char *, int);
   API_EXPORT_NONSTD(const char *) ap_set_file_slot(cmd_parms *, char *, char *);
   
  
  
  
  1.65      +4 -2      apache-2.0/src/main/http_config.c
  
  Index: http_config.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_config.c,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- http_config.c	2000/06/17 16:29:47	1.64
  +++ http_config.c	2000/06/17 21:37:04	1.65
  @@ -1097,13 +1097,15 @@
   }
   
   API_EXPORT_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *cmd,
  -						char *struct_ptr, char *arg)
  +							 void *struct_ptr,
  +							 const char *arg_)
   {
       /* This one's pretty generic... */
  +    char *arg=ap_pstrdup(cmd->pool,arg_);
   
       int offset = (int) (long) cmd->info;
       ap_str_tolower(arg);
  -    *(char **) (struct_ptr + offset) = arg;
  +    *(char **) ((char *)struct_ptr + offset) = arg;
       return NULL;
   }
   
  
  
  
  1.19      +53 -36    apache-2.0/src/modules/standard/mod_mime.c
  
  Index: mod_mime.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_mime.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- mod_mime.c	2000/05/27 22:40:37	1.18
  +++ mod_mime.c	2000/06/17 21:37:05	1.19
  @@ -180,9 +180,12 @@
       return new;
   }
   
  -static const char *add_type(cmd_parms *cmd, mime_dir_config *m, char *ct,
  -                            char *ext)
  +static const char *add_type(cmd_parms *cmd, void *m_, const char *ct_,
  +                            const char *ext)
   {
  +    mime_dir_config *m=m_;
  +    char *ct=ap_pstrdup(cmd->pool,ct_);
  +
       if (*ext == '.')
   	++ext;
   	
  @@ -191,9 +194,12 @@
       return NULL;
   }
   
  -static const char *add_encoding(cmd_parms *cmd, mime_dir_config *m, char *enc,
  -                                char *ext)
  +static const char *add_encoding(cmd_parms *cmd, void *m_, const char *enc_,
  +				const char *ext)
   {
  +    mime_dir_config *m=m_;
  +    char *enc=ap_pstrdup(cmd->pool,enc_);
  +
       if (*ext == '.')
           ++ext;
       ap_str_tolower(enc);
  @@ -201,9 +207,12 @@
       return NULL;
   }
   
  -static const char *add_charset(cmd_parms *cmd, mime_dir_config *m,
  -			       char *charset, char *ext)
  +static const char *add_charset(cmd_parms *cmd, void *m_, const char *charset_,
  +			       const char *ext)
   {
  +    mime_dir_config *m=m_;
  +    char *charset=ap_pstrdup(cmd->pool,charset_);
  +
       if (*ext == '.') {
   	++ext;
       }
  @@ -212,9 +221,12 @@
       return NULL;
   }
   
  -static const char *add_language(cmd_parms *cmd, mime_dir_config *m, char *lang,
  -                                char *ext)
  +static const char *add_language(cmd_parms *cmd, void *m_, const char *lang_,
  +                                const char *ext)
   {
  +    mime_dir_config *m=m_;
  +    char *lang=ap_pstrdup(cmd->pool,lang_);
  +
       if (*ext == '.') {
   	++ext;
       }
  @@ -223,9 +235,12 @@
       return NULL;
   }
   
  -static const char *add_handler(cmd_parms *cmd, mime_dir_config *m, char *hdlr,
  -                               char *ext)
  +static const char *add_handler(cmd_parms *cmd, void *m_, const char *hdlr_,
  +                               const char *ext)
   {
  +    mime_dir_config *m=m_;
  +    char *hdlr=ap_pstrdup(cmd->pool,hdlr_);
  +
       if (*ext == '.')
           ++ext;
       ap_str_tolower(hdlr);
  @@ -238,7 +253,7 @@
    * will keep the association from being inherited, as well, but not
    * from being re-added at a subordinate level.
    */
  -static const char *remove_handler(cmd_parms *cmd, void *m, char *ext)
  +static const char *remove_handler(cmd_parms *cmd, void *m, const char *ext)
   {
       mime_dir_config *mcfg = (mime_dir_config *) m;
       handlers_info *hand;
  @@ -255,37 +270,39 @@
    * the name of its config file, so...
    */
   
  -static const char *set_types_config(cmd_parms *cmd, void *dummy, char *arg)
  +static const char *set_types_config(cmd_parms *cmd, void *dummy,
  +				    const char *arg)
   {
  -    ap_set_module_config(cmd->server->module_config, &mime_module, arg);
  +    ap_set_module_config(cmd->server->module_config, &mime_module,
  +			 (void *)arg);
       return NULL;
   }
   
   static const command_rec mime_cmds[] =
   {
  -    {"AddType", add_type, NULL, OR_FILEINFO, ITERATE2,
  -     "a mime type followed by one or more file extensions"},
  -    {"AddEncoding", add_encoding, NULL, OR_FILEINFO, ITERATE2,
  -     "an encoding (e.g., gzip), followed by one or more file extensions"},
  -    {"AddCharset", add_charset, NULL, OR_FILEINFO, ITERATE2,
  -     "a charset (e.g., iso-2022-jp), followed by one or more file extensions"},
  -    {"AddLanguage", add_language, NULL, OR_FILEINFO, ITERATE2,
  -     "a language (e.g., fr), followed by one or more file extensions"},
  -    {"AddHandler", add_handler, NULL, OR_FILEINFO, ITERATE2,
  -     "a handler name followed by one or more file extensions"},
  -    {"ForceType", ap_set_string_slot_lower, 
  -     (void *)XtOffsetOf(mime_dir_config, type), OR_FILEINFO, TAKE1, 
  -     "a media type"},
  -    {"RemoveHandler", remove_handler, NULL, OR_FILEINFO, ITERATE,
  -     "one or more file extensions"},
  -    {"SetHandler", ap_set_string_slot_lower, 
  -     (void *)XtOffsetOf(mime_dir_config, handler), OR_FILEINFO, TAKE1, 
  -     "a handler name"},
  -    {"TypesConfig", set_types_config, NULL, RSRC_CONF, TAKE1,
  -     "the MIME types config file"},
  -    {"DefaultLanguage", ap_set_string_slot,
  -     (void*)XtOffsetOf(mime_dir_config, default_language), OR_FILEINFO, TAKE1,
  -     "language to use for documents with no other language file extension" },
  +AP_INIT_ITERATE2("AddType", add_type, NULL, OR_FILEINFO, 
  +     "a mime type followed by one or more file extensions"),
  +AP_INIT_ITERATE2("AddEncoding", add_encoding, NULL, OR_FILEINFO,
  +     "an encoding (e.g., gzip), followed by one or more file extensions"),
  +AP_INIT_ITERATE2("AddCharset", add_charset, NULL, OR_FILEINFO,
  +     "a charset (e.g., iso-2022-jp), followed by one or more file extensions"),
  +AP_INIT_ITERATE2("AddLanguage", add_language, NULL, OR_FILEINFO,
  +     "a language (e.g., fr), followed by one or more file extensions"),
  +AP_INIT_ITERATE2("AddHandler", add_handler, NULL, OR_FILEINFO,
  +     "a handler name followed by one or more file extensions"),
  +AP_INIT_TAKE1("ForceType", ap_set_string_slot_lower, 
  +     (void *)XtOffsetOf(mime_dir_config, type), OR_FILEINFO,
  +     "a media type"),
  +AP_INIT_ITERATE("RemoveHandler", remove_handler, NULL, OR_FILEINFO,
  +     "one or more file extensions"),
  +AP_INIT_TAKE1("SetHandler", ap_set_string_slot_lower, 
  +     (void *)XtOffsetOf(mime_dir_config, handler), OR_FILEINFO,
  +     "a handler name"),
  +AP_INIT_TAKE1("TypesConfig", set_types_config, NULL, RSRC_CONF,
  +     "the MIME types config file"),
  +AP_INIT_TAKE1("DefaultLanguage", ap_set_string_slot,
  +     (void*)XtOffsetOf(mime_dir_config, default_language), OR_FILEINFO,
  +     "language to use for documents with no other language file extension"),
       {NULL}
   };
   
  
  
  

Re: cvs commit: apache-2.0/src/modules/standard mod_mime.c

Posted by Greg Stein <gs...@lyra.org>.
On Sat, Jun 17, 2000 at 09:37:05PM -0000, ben@locus.apache.org wrote:
> ben         00/06/17 14:37:05
> 
>   Modified:    src/include http_config.h
>                src/main http_config.c
>                src/modules/standard mod_mime.c
>   Log:
>   More command handlers.
>   
>   Revision  Changes    Path
>   1.35      +4 -1      apache-2.0/src/include/http_config.h
>   
>   Index: http_config.h
>   ===================================================================
>   RCS file: /home/cvs/apache-2.0/src/include/http_config.h,v
>   retrieving revision 1.34
>   retrieving revision 1.35
>   diff -u -r1.34 -r1.35
>   --- http_config.h	2000/06/17 16:53:50	1.34
>   +++ http_config.h	2000/06/17 21:37:02	1.35
>   @@ -131,6 +131,8 @@
>        { directive, { .take2=func }, mconfig, where, TAKE2, help }
>    # define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
>        { directive, { .take2=func }, mconfig, where, TAKE12, help }
>   +# define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
>   +    { directive, { .take2=func }, mconfig, where, ITERATE2, help }
>    # define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
>        { directive, { .take3=func }, mconfig, where, TAKE23, help }
>    # define AP_INIT_FLAG(directive, func, mconfig, where, help) \

Ben - you haven't been paying attention at all to the non-AP_DEBUG branch.
Jeff caught a batch of that work earlier, but please make sure that you
update both branches.

IOW, you are now missing AP_INIT_ITERATE2() from the non-AP_DEBUG branch.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/