Bug 40453

Summary: lexicographic compare in RewriteCond isn't lexicographic
Product: Apache httpd-2 Reporter: Sig Porter <ohtfl>
Component: mod_rewriteAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: NEW ---    
Severity: normal Keywords: FixedInTrunk
Priority: P3    
Version: 2.5-HEAD   
Target Milestone: ---   
Hardware: Other   
OS: Linux   
URL: http://koiclubsandiego.org/bug/

Description Sig Porter 2006-09-09 05:44:43 UTC
Documentation states that when < or > precedes CondPattern, "Treats the
CondPattern as a plain string and compares it lexicographically to TestString."
It doesn't work that way. See url, above, for examples and details.
Comment 1 Stefan Fritsch 2011-06-13 21:00:58 UTC
This is fixed in trunk by allowing to use the new ap_expr expression parser in RewriteCond. I don't think we will change the historical RewriteCond behaviour.
Comment 2 Alain Williams 2018-01-19 16:24:52 UTC
The original URL no longer works: http://koiclubsandiego.org/bug/
I am thus not 100% sure what the original bug report was.

I assume that it is saying that compare_lexicography() in mod_rewrite.c , when given 2 strings of different lengths, returns lexical order based on the string length and not the string contents. Ie AAA is greater than B.

What has not been done is to DOCUMENT this bug; ie there ought to be something in docs/manual/mod/mod_rewrite.html.en near line 527 that describes this strange behaviour; and that the fix is to use ap_expr. The bug is not present with case independent compare (flag NC).

If asked I will produce a patch to the documentation
Comment 3 Christophe JAILLET 2018-08-25 18:22:57 UTC
The proposal is old, but patches are always welcome.