Browse Source

buffer_caseless_compare: always convert letters to lowercase to get transitive results, fixing array lookups (fixes #2405)

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2828 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.31
Stefan Bühler 10 years ago
parent
commit
e697869e34
  1. 1
      NEWS
  2. 11
      src/buffer.c

1
NEWS

@ -8,6 +8,7 @@ NEWS
* Move fdevent subsystem includes to implementation files to reduce conflicts (fixes #2373)
* [mod_compress] fix handling if etags are disabled but cache-dir is set - may lead to double response
* disable mmap by default (fixes #2391)
* buffer_caseless_compare: always convert letters to lowercase to get transitive results, fixing array lookups (fixes #2405)
- 1.4.30 - 2011-12-18
* Always use our 'own' md5 implementation, fixes linking issues on MacOS (fixes #2331)

11
src/buffer.c

@ -566,15 +566,14 @@ int buffer_caseless_compare(const char *a, size_t a_len, const char *b, size_t b
max_ndx = ((a_len < b_len) ? a_len : b_len);
for (; ndx < max_ndx; ndx++) {
char a1 = *a++, b1 = *b++;
int a1 = *a++, b1 = *b++;
if (a1 != b1) {
if ((a1 >= 'A' && a1 <= 'Z') && (b1 >= 'a' && b1 <= 'z'))
a1 |= 32;
else if ((a1 >= 'a' && a1 <= 'z') && (b1 >= 'A' && b1 <= 'Z'))
b1 |= 32;
if ((a1 - b1) != 0) return (a1 - b1);
/* always lowercase for transitive results */
if (a1 >= 'A' && a1 <= 'Z') a1 |= 32;
if (b1 >= 'A' && b1 <= 'Z') b1 |= 32;
if ((a1 - b1) != 0) return (a1 - b1);
}
}

Loading…
Cancel
Save