Bug 47664 - ap_proxy_canonenc: does not recode all high-byte chars back into %HH form
Summary: ap_proxy_canonenc: does not recode all high-byte chars back into %HH form
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_proxy (show other bugs)
Version: 2.2.12
Hardware: Sun Solaris
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Keywords: PatchAvailable
Depends on:
Reported: 2009-08-07 13:29 UTC by Marco Walther
Modified: 2011-09-25 21:28 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Marco Walther 2009-08-07 13:29:19 UTC
I have a URL with an utf-8 encoded `รณ' in it. mod_proxy mangles that when `nocanon' is not set.

The problem is that one byte is translated back into the %HH form but the othe one is not:-(

Some pieces of errorlog: (I added some log entries not in the normal source;-)
mod_proxy_balancer.c(46): proxy: BALANCER: canonicalising URL //cluster_foo/projects/mw-test/pages/\xc3\xb3/edit
mod_proxy_balancer.c(71): proxy: BALANCER: mw canonicalised URL projects/mw-test/pages/\xc3%B3/edit (len 32)
mod_proxy_balancer.c(82): proxy: BALANCER: mw canonicalised filename proxy:balancer://cluster_foo/projects/mw-test/pages/\xc3%B3/edit (len 63)
mod_proxy_balancer.c(1152): proxy: Entering bybusyness for BALANCER (balancer://cluster_foo)
mod_proxy_balancer.c(1211): proxy: bybusyness selected worker "http://be:8280" : busy 0 : lbstatus -1
mod_proxy_balancer.c(581): proxy: BALANCER (balancer://cluster_foo) worker (http
://be:8280) rewritten to http://be:8280/projects/mw-test/pages/\xc3%B3/edit
mod_proxy.c(993): Running scheme balancer handler (attempt 0)
mod_proxy_http.c(1920): proxy: HTTP: serving URL http://be:8280/projects/mw-test/pages/\xc3%B3/edit
proxy_util.c(1991): proxy: HTTP: has acquired connection for (be)
proxy_util.c(2047): proxy: connecting http://be:8280/projects/mw-test/pages/\xc3%B3/edit to be:8280
proxy_util.c(2145): proxy: connected /projects/mw-test/pages/\xc3%B3/edit to be:8280

The problem seems to be in proxy_util.c - ap_proxy_canonenc, some (?) char's are not recoded.

I changed the source a bit and now it seems to work better: The diff is for 2.2.11 but that area did not change in 2.2.12!!

--- httpd-2.2.11-orig/modules/proxy/proxy_util.c     Tue Nov 11 12:04:34 2008
+++ httpd-2.2.11-work/modules/proxy/proxy_util.c     Fri Aug  7 12:38:20 2009
@@ -213,7 +213,7 @@
 /* recode it, if necessary */
-        if (!apr_isalnum(ch) && !strchr(allowed, ch)) {
+        if (!(apr_isascii(ch) && apr_isalnum(ch)) && !strchr(allowed, ch)) {
             ap_proxy_c2hex(ch, &y[j]);
             j += 2;