www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Scherg <Rainer.Sch...@rexroth.de>
Subject RE: mod_negotiation/3430: Enhancement: MultiViews, Multi-Language Documents
Date Fri, 27 Nov 1998 17:50:00 GMT
The following reply was made to PR mod_negotiation/3430; it has been noted by GNATS.

From: Rainer Scherg <Rainer.Scherg@rexroth.de>
To: "'pcs@apache.org'" <pcs@apache.org>
Cc: "'apbugs@apache.org'" <apbugs@apache.org>
Subject: RE: mod_negotiation/3430: Enhancement: MultiViews, Multi-Language Documents
Date: Fri, 27 Nov 1998 17:09:58 +0100

 Hi!
 
 I've done some work on this #PR.
 I've made enhancements to mod_mime.c to define a DefaultLanguage.
 
    Syntax:   DefaultLanguage  <mime-language-type>
    The context is the same as AddLanguage.
 
    DefaultLanguage defines the MIME-language for all documents
    not covered by the AddLanguage directive.
 
 This should fix also the problem, that apache is returning a
 wrong language (doc), when more than one language is requested
 by the browser. This also should fix an old #PR1180.
 
 The following source stuff is only roughly tested...
 Please give a short feedback if there's any problem/question.
 
 Still ToDO: HTML-Doc
 
 Listing below is: gnudiff -u  cvs-file  orgfile
 
 Regards Rainer
 
   Rainer.Scherg@rexroth.de
   Rainer.Scherg@t-online.de
 
 
 ======= snip ======
 
 
 --- mod_mime.org.c	Fri Nov 27 16:51:11 1998
 +++ mod_mime.c	Fri Nov 27 16:49:16 1998
 @@ -59,7 +59,11 @@
   * http_mime.c: Sends/gets MIME headers for requests
   *
   * Rob McCool
 - *
 + *
 + * 1998-11-27 (rasc)  Rainer.Scherg@t-online.de
 + *          - DefaultLanguage  MIME-LANG
 + *            define language for documents not fitting to definitions
 + *            set by AddLanguage
   */
 
  #define MIME_PRIVATE
 @@ -148,6 +152,13 @@
      return NULL;
  }
 
 +static const char *add_default_language(cmd_parms *cmd, mime_dir_config * 
 m,
 +					char *lang)
 +{
 +    /* store default language as MIME with empty extension  (rasc) */
 +    return add_language (cmd,m,lang,"");
 +}
 +
  static const char *add_handler(cmd_parms *cmd, mime_dir_config * m, char 
 *hdlr,
                                 char *ext)
  {
 @@ -176,6 +187,8 @@
       "an encoding (e.g., gzip), 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"},
 +    {"DefaultLanguage", add_default_language, NULL, OR_FILEINFO, TAKE1,
 +     "the MIME type of the default language (documents not specified with 
 AddLanguage)"},
      {"AddHandler", add_handler, NULL, OR_FILEINFO, ITERATE2,
       "a handler name followed by one or more file extensions"},
      {"ForceType", ap_set_string_slot_lower,
 @@ -248,6 +261,8 @@
      char *ext;
      const char *orighandler = r->handler;
      const char *type;
 +    int   valid_found = 0;
 +
 
      if (S_ISDIR(r->finfo.st_mode)) {
          r->content_type = DIR_MAGIC_TYPE;
 @@ -262,7 +277,12 @@
      if (fn == NULL)
          fn = r->filename;
 
 -    /* Parse filename extensions, which can be in any order */
 +
 +    /* Parse filename extensions, which can be in any order
 +       $$$ But left to right...
 +       $$$ Unknown ext invalids all mimes up to this point.
 +       $$$ e.g.  test.hello.en.unknown.fr.htm ==>  result: fr & htm
 +    */
      while ((ext = ap_getword(r->pool, &fn, '.')) && *ext) {
          int found = 0;
 
 @@ -308,13 +328,35 @@
 
          if (!found) {
              r->content_type = NULL;
 -            r->content_language = NULL;
 +            r->content_language = NULL;  /* back compat */
              r->content_languages = NULL;
              r->content_encoding = NULL;
              r->handler = orighandler;
 +            valid_found = 0;
 +        } else {
 +            valid_found = 1;
          }
 
      }
 +
 +    /*
 +     * Check if MIME language found,
 +     * else use Default-MIME-Language (== empty ext-key in table)
 +     */
 +
 +    if (valid_found && !r->content_languages) {
 +       if ((type = ap_table_get(conf->language_types, ""))) {
 +          const char **new;
 +
 +          r->content_language = type;         /* back compat. only */
 +          r->content_languages = ap_make_array(r->pool, 2, sizeof(char 
 *));
 +          new = (const char **) ap_push_array(r->content_languages);
 +          *new = type;
 +        }
 +    }
 +
 +
 +
 
      /* Check for overrides with ForceType/SetHandler */
 
 

Mime
View raw message