summaryrefslogtreecommitdiff
path: root/server/util.c
diff options
context:
space:
mode:
authorStefan Fritsch <sf@sfritsch.de>2011-12-27 19:42:33 +0100
committerStefan Fritsch <sf@sfritsch.de>2011-12-27 19:42:33 +0100
commitad14e19ad0400e289b06fb7728aea815e6ed49be (patch)
treebd29489cafb04b303940169ae7b00c1171a5a34c /server/util.c
parent02a0e3b89d2ea1b984365e692c910668d75c6dcd (diff)
downloadapache2-ad14e19ad0400e289b06fb7728aea815e6ed49be.tar.gz
Upstream tarball 2.2.12upstream/2.2.12
Diffstat (limited to 'server/util.c')
-rw-r--r--server/util.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/server/util.c b/server/util.c
index 3c927c23..e16b8eb2 100644
--- a/server/util.c
+++ b/server/util.c
@@ -1737,7 +1737,7 @@ AP_DECLARE(char *) ap_os_escape_path(apr_pool_t *p, const char *path, int partia
/* ap_escape_uri is now a macro for os_escape_path */
-AP_DECLARE(char *) ap_escape_html(apr_pool_t *p, const char *s)
+AP_DECLARE(char *) ap_escape_html2(apr_pool_t *p, const char *s, int toasc)
{
int i, j;
char *x;
@@ -1750,6 +1750,8 @@ AP_DECLARE(char *) ap_escape_html(apr_pool_t *p, const char *s)
j += 4;
else if (s[i] == '"')
j += 5;
+ else if (toasc && !apr_isascii(s[i]))
+ j += 5;
if (j == 0)
return apr_pstrmemdup(p, s, i);
@@ -1772,13 +1774,21 @@ AP_DECLARE(char *) ap_escape_html(apr_pool_t *p, const char *s)
memcpy(&x[j], "&quot;", 6);
j += 5;
}
+ else if (toasc && !apr_isascii(s[i])) {
+ char *esc = apr_psprintf(p, "&#%3.3d;", (unsigned char)s[i]);
+ memcpy(&x[j], esc, 6);
+ j += 5;
+ }
else
x[j] = s[i];
x[j] = '\0';
return x;
}
-
+AP_DECLARE(char *) ap_escape_html(apr_pool_t *p, const char *s)
+{
+ return ap_escape_html2(p, s, 0);
+}
AP_DECLARE(char *) ap_escape_logitem(apr_pool_t *p, const char *str)
{
char *ret;