dovecot-2.2: lib-http: Improved display of invalid characters in...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Sep 15 03:50:34 EEST 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/bbe4a469e276
changeset: 16746:bbe4a469e276
user: Stephan Bosch <stephan at rename-it.nl>
date: Sun Sep 15 03:46:25 2013 +0300
description:
lib-http: Improved display of invalid characters in parse error messages.
diffstat:
src/lib-http/http-request-parser.c | 8 ++++++--
src/lib-http/http-response-parser.c | 8 ++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
diffs (36 lines):
diff -r 572b9a9031e7 -r bbe4a469e276 src/lib-http/http-request-parser.c
--- a/src/lib-http/http-request-parser.c Sun Sep 15 03:46:12 2013 +0300
+++ b/src/lib-http/http-request-parser.c Sun Sep 15 03:46:25 2013 +0300
@@ -96,8 +96,12 @@
static inline const char *_chr_sanitize(unsigned char c)
{
if (c >= 0x20 && c < 0x7F)
- return t_strdup_printf("'%c'", c);
- return t_strdup_printf("0x%02x", c);
+ return t_strdup_printf("`%c'", c);
+ if (c == 0x0a)
+ return "<LF>";
+ if (c == 0x0d)
+ return "<CR>";
+ return t_strdup_printf("<0x%02x>", c);
}
static int http_request_parse(struct http_request_parser *parser,
diff -r 572b9a9031e7 -r bbe4a469e276 src/lib-http/http-response-parser.c
--- a/src/lib-http/http-response-parser.c Sun Sep 15 03:46:12 2013 +0300
+++ b/src/lib-http/http-response-parser.c Sun Sep 15 03:46:25 2013 +0300
@@ -94,8 +94,12 @@
static inline const char *_chr_sanitize(unsigned char c)
{
if (c >= 0x20 && c < 0x7F)
- return t_strdup_printf("'%c'", c);
- return t_strdup_printf("0x%02x", c);
+ return t_strdup_printf("`%c'", c);
+ if (c == 0x0a)
+ return "<LF>";
+ if (c == 0x0d)
+ return "<CR>";
+ return t_strdup_printf("<0x%02x>", c);
}
static int http_response_parse(struct http_response_parser *parser,
More information about the dovecot-cvs
mailing list