https://issues.apache.org/bugzilla/show_bug.cgi?id=50357

--- Comment #1 from Christoph Anton Mitterer <[email protected]> 2010-11-28 
17:42:07 EST ---
IMHO the best way to implement this is by adding a new directive which allows
to set a format string" that defines how matching is done.
The default string could be one which is just equal to the current behaviour
off matching anything at any position.

Maybe something like this:
1) ExtensionsMatchFormat "formatstring"

Where formatstring is a PCRE with the following additional special symbols:

%t = _one_ previously defined type
%c = _one_ previously defined charset
%e = _one_ previously defined encoding
%l = _one_ previously defined language
%h = _one_ previously defined handler
%i = _one_ previously defined input filter
%o = _one_ previously defined output filter

Currently this is, as far as I can see, something like this:
(?i)(.%t|.%c|.%e|.%l|.%h|.%i|.%o)*
meaning, any number of extensions of any given type at any position.

Note that this allows to change the separation character ("."), and to make it
case-insensitive or not.


2) One needs further Directives which specify which matches are to be used.
Examples for type, charset, encoding, language could be:

TypeMatch formatstring1 formatstring2
CharsetMatch formatstring1 formatstring2
...
where:
formatstring1 determines which of the %t's (extensions-groups) from above to
use with formatstring2, with:
\* => Use all
\n => Use the n-th one
e.g. in "(?i)(.%t|.%c|.%e|.%l|.%h|.%i|.%o)*" from above:
TypesMatch "\*" ...
would mean, consider all (valid) %t-groups with when matching formatstring2
TypesMatch "\1\3" ...
would mean, consider the (valid) 1st and the (valid) 3rd when matching
formatstring2
So ".pdf.gz.html.Z.png.Z.Z.txt" would yield the following:
with "\*": ".pdf.html.png.txt"
with "\1\3" ".pdf.png"

formatstring2 decides which of the result from formatstring1 should be actually
and finally be used, with (again some kind of a PCRE):
"*" => use all
"($U)\.*$" => use the last (most right) extension (I hope my ungreedy PCRE is
correct)




So my proposal from comment #1 could look like the following (I hope my PCREs
are correct ;) ):
ExtensionsMatchFormat "^.*.+(\.%l|\.%c)*(\.%t)*(\.%l|\.%c)*(\.%e)*$"


TypesMatch "\*" "($U)\.*$"
=> concatenate all %t-groups
=> take the last one form them

CharsetMatch "\*" "($U)\.*$"
=> concatenate all %c-groups
=> take the last one form them


LangMatch "\*" "*"
=> concatenate all %l-groups
=> take all of them

EncodingMatch "\*" "*"
=> concatenate all %e-groups
=> take all of them

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to