Bug 40453 - lexicographic compare in RewriteCond isn't lexicographic
Summary: lexicographic compare in RewriteCond isn't lexicographic
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_rewrite (show other bugs)
Version: 2.5-HEAD
Hardware: Other Linux
: P3 normal with 1 vote (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL: http://koiclubsandiego.org/bug/
Keywords: FixedInTrunk
Depends on:
Reported: 2006-09-09 05:44 UTC by Sig Porter
Modified: 2018-08-25 18:22 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this 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.