You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by André Malo <nd...@perlig.de> on 2003/01/22 02:55:18 UTC

make mod_negotiation more configurable

I'm planning to apply some request dependent extensions to mod_negotiation. 
The first is ready-to-commit :) but I'd like to hear some comments about 
them in general.
The main goal is to make some configuration cases more simple.

The attached patch (mod_negotiation.c.patch) introduces a new special 
variable "prefer-language" which influences mod_negotiation in that way, 
that it first tries to select only variants that have the specified 
language tag. If no success, it tries negotiation again with all variants.
A more readable patch (without the addional indentation) is also attached.

This allows, however, cool configurations like the following:

AliasMatch ^/manual(?:/(?:de|en|ja|pt-br|ru))?(/.*)? \
            /path/to/manual$1

<Directory "/path/to/manual">
  [...normal stuff...]

# would be nice, but isn't supported yet:
#    SetEnvIf Request_URI ^/manual/(de|en|ja|pt-br|ru)/ \
#               prefer-language=$1

    SetEnvIf Request_URI ^/manual/de/    prefer-language=de
    SetEnvIf Request_URI ^/manual/en/    prefer-language=en
    SetEnvIf Request_URI ^/manual/ja/    prefer-language=ja
    SetEnvIf Request_URI ^/manual/pt-br/ prefer-language=pt-br
    SetEnvIf Request_URI ^/manual/ru/    prefer-language=ru
</Directory>

As you may guess, it would be very useful for the distributed documentation 
(there are/were already some discussions about the problem). So I'd also 
propose a backport to 2.0.

The next step would be to make mod_negotiation recognize "no-gzip" and 
"gzip-only-text/html", too. In fact, I had an early patch for that (which 
dropped encoded variants entirely from the list), but I think, if it's 
implemented similar to the "prefer-language" code, it's much better.

Any comments, suggestions or objections?
If not, I'm going to commit the stuff :)

nd
-- 
Flhacs wird im Usenet grundsätzlich alsfhc geschrieben. Schreibt man
lafhsc nicht slfach, so ist das schlichtweg hclafs. Hingegen darf man
rihctig ruhig rhitcgi schreiben, weil eine shcalfe Schreibweise bei
irhictg nicht als shflac angesehen wird.       -- Hajo Pflüger in dnq

Re: make mod_negotiation more configurable

Posted by André Malo <nd...@perlig.de>.
* André Malo wrote:

> I'm planning to apply some request dependent extensions to mod_negotiation.
> The first is ready-to-commit :) but I'd like to hear some comments about
> them in general.
> The main goal is to make some configuration cases more simple.

Just sending a ping for those who may have overlooked the mail. Fullquote 
without attachments follows:

> The attached patch (mod_negotiation.c.patch) introduces a new special
> variable "prefer-language" which influences mod_negotiation in that way,
> that it first tries to select only variants that have the specified
> language tag. If no success, it tries negotiation again with all variants.
> A more readable patch (without the addional indentation) is also attached.
> 
> This allows, however, cool configurations like the following:
> 
> AliasMatch ^/manual(?:/(?:de|en|ja|pt-br|ru))?(/.*)? \
>             /path/to/manual$1
> 
> <Directory "/path/to/manual">
>   [...normal stuff...]
> 
> # would be nice, but isn't supported yet:
> #    SetEnvIf Request_URI ^/manual/(de|en|ja|pt-br|ru)/ \
> #               prefer-language=$1
> 
>     SetEnvIf Request_URI ^/manual/de/    prefer-language=de
>     SetEnvIf Request_URI ^/manual/en/    prefer-language=en
>     SetEnvIf Request_URI ^/manual/ja/    prefer-language=ja
>     SetEnvIf Request_URI ^/manual/pt-br/ prefer-language=pt-br
>     SetEnvIf Request_URI ^/manual/ru/    prefer-language=ru
> </Directory>
> 
> As you may guess, it would be very useful for the distributed documentation
> (there are/were already some discussions about the problem). So I'd also
> propose a backport to 2.0.
> 
> The next step would be to make mod_negotiation recognize "no-gzip" and
> "gzip-only-text/html", too. In fact, I had an early patch for that (which
> dropped encoded variants entirely from the list), but I think, if it's
> implemented similar to the "prefer-language" code, it's much better.
> 
> Any comments, suggestions or objections?
> If not, I'm going to commit the stuff :)
> 
> nd
-- 
Wenn nur Ingenieure mit Diplom programmieren würden, hätten wir
wahrscheinlich weniger schlechte Software.
Wir hätten allerdings auch weniger gute Software.
                                   -- Felix von Leitner in dasr