Bug 47664

Summary: ap_proxy_canonenc: does not recode all high-byte chars back into %HH form
Product: Apache httpd-2 Reporter: Marco Walther <marco.walther>
Component: mod_proxyAssignee: Apache HTTPD Bugs Mailing List <bugs>
Severity: normal Keywords: MassUpdate, PatchAvailable
Priority: P2    
Version: 2.2.12   
Target Milestone: ---   
Hardware: Sun   
OS: Solaris   

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;
Comment 1 William A. Rowe Jr. 2018-11-07 21:08:01 UTC
Please help us to refine our list of open and current defects; this is a mass update of old and inactive Bugzilla reports which reflect user error, already resolved defects, and still-existing defects in httpd.

As repeatedly announced, the Apache HTTP Server Project has discontinued all development and patch review of the 2.2.x series of releases. The final release 2.2.34 was published in July 2017, and no further evaluation of bug reports or security risks will be considered or published for 2.2.x releases. All reports older than 2.4.x have been updated to status RESOLVED/LATER; no further action is expected unless the report still applies to a current version of httpd.

If your report represented a question or confusion about how to use an httpd feature, an unexpected server behavior, problems building or installing httpd, or working with an external component (a third party module, browser etc.) we ask you to start by bringing your question to the User Support and Discussion mailing list, see [https://httpd.apache.org/lists.html#http-users] for details. Include a link to this Bugzilla report for completeness with your question.

If your report was clearly a defect in httpd or a feature request, we ask that you retest using a modern httpd release (2.4.33 or later) released in the past year. If it can be reproduced, please reopen this bug and change the Version field above to the httpd version you have reconfirmed with.

Your help in identifying defects or enhancements still applicable to the current httpd server software release is greatly appreciated.