httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dirk.vanGulik" <Dirk.vanGu...@jrc.it>
Subject Re: Multiple Content Languages
Date Mon, 21 Oct 1996 14:44:34 GMT

Very good work ! Works like a dream. Now we have to figure out something
like it for the charset/encoding pair :-)

Dw.

> HTTP/1.1 allows each resource to have more than one content-language
> associated with it. Apache currently handles only a single content
> language, so, for example
> 
>    foo.en.fr.html
> 
> would be returned with Content-Language: fr (the fr overrides the en
> because extensions are parsed left-to-right).
> 
> The patch below updates Apache to support more than one language per
> resource. It replaces(*) the request_rec's content_language string
> with an array, content_languages. mod_mime.c is updated to push each
> language from the filename onto this array, and http_protocol.c writes
> out a correct Content-Language response header.
> 
> (* for backwards compatibility, r->content_language is still available
> to modules. It now records the _first_ language encountered in the
> file extensions, since that seemed more logical. The code to output
> the Content-Language header ignores this field though, so if any
> changes a module makes to r->content_language will be ignored. I'll
> update mod_negotiation to handle multiple languages in each variant
> soon).
> 
> Paul
> -
> 
> Index: http_protocol.c
> ===================================================================
> RCS file: /export/home/cvs/apache/src/http_protocol.c,v
> retrieving revision 1.61
> diff -c -r1.61 http_protocol.c
> *** http_protocol.c	1996/10/20 20:45:50	1.61
> --- http_protocol.c	1996/10/21 12:16:26
> ***************
> *** 1012,1019 ****
>       if (r->content_encoding)
>           bvputs(fd,"Content-Encoding: ", r->content_encoding, "\015\012", NULL);
> 
> !     if (r->content_language)
> !         bvputs(fd,"Content-Language: ", r->content_language, "\015\012", NULL);
> 
>       /* We now worry about this here */
> 
> --- 1012,1026 ----
>       if (r->content_encoding)
>           bvputs(fd,"Content-Encoding: ", r->content_encoding, "\015\012", NULL);
> 
> !     if (r->content_languages && r->content_languages->nelts) {
> ! 	int i;
> ! 	bputs("Content-Langauge: ", fd);
> ! 	for (i = 0; i < r->content_languages->nelts; ++i) {
> ! 	    char *lang = ((char**)(r->content_languages->elts))[i];
> ! 	    bvputs(fd, i ? ", " : "", lang, NULL);
> ! 	}
> ! 	bputs("\015\012", fd);
> !     }
> 
>       /* We now worry about this here */
> 
> Index: httpd.h
> ===================================================================
> RCS file: /export/home/cvs/apache/src/httpd.h,v
> retrieving revision 1.57
> diff -c -r1.57 httpd.h
> *** httpd.h	1996/10/20 20:45:52	1.57
> --- httpd.h	1996/10/21 12:16:27
> ***************
> *** 451,457 ****
>     char *handler;		/* What we *really* dispatch on           */
> 
>     char *content_encoding;
> !   char *content_language;
> 
>     int no_cache;
>     int no_local_copy;
> --- 451,458 ----
>     char *handler;		/* What we *really* dispatch on           */
> 
>     char *content_encoding;
> !   char *content_language;	/* for back-compat. only -- do not use */
> !   array_header *content_languages;
> 
>     int no_cache;
>     int no_local_copy;
> Index: mod_mime.c
> ===================================================================
> RCS file: /export/home/cvs/apache/src/mod_mime.c,v
> retrieving revision 1.12
> diff -c -r1.12 mod_mime.c
> *** mod_mime.c	1996/10/20 18:03:36	1.12
> --- mod_mime.c	1996/10/21 12:16:27
> ***************
> *** 250,256 ****
> 
>         /* Check for Content-Language */
>         if ((type = table_get (conf->language_types, ext))) {
> ! 	  r->content_language = type;
>   	  found = 1;
>         }
> 
> --- 250,263 ----
> 
>         /* Check for Content-Language */
>         if ((type = table_get (conf->language_types, ext))) {
> ! 	  char **new;
> !
> ! 	  if (!r->content_language)
> ! 	      r->content_language = type; /* back compat. only */
> ! 	  if (!r->content_languages)
> ! 	      r->content_languages = make_array (r->pool, 2, sizeof(char*));
> ! 	  new = (char **)push_array (r->content_languages);
> ! 	  *new = type;
>   	  found = 1;
>         }
> 
> ***************
> *** 278,283 ****
> --- 285,291 ----
>         if (!found) {
>   	r->content_type = NULL;
>   	r->content_language = NULL;
> + 	r->content_languages = NULL;
>   	r->content_encoding = NULL;
>   	r->handler = orighandler;
>         }
> 
> 
> 


Mime
View raw message