From: Stephan Bosch Date: Fri, 15 Oct 2021 20:18:06 +0000 (+0200) Subject: lib-http: http-url - Improve error messages by showing which character is unexpected. X-Git-Tag: 2.4.0~4707 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7dee8607c625eab1d3ff82d2d6727f2b1d13dc34;p=thirdparty%2Fdovecot%2Fcore.git lib-http: http-url - Improve error messages by showing which character is unexpected. --- diff --git a/src/lib-http/http-url.c b/src/lib-http/http-url.c index 229a58a0b3..4a9e3a85be 100644 --- a/src/lib-http/http-url.c +++ b/src/lib-http/http-url.c @@ -464,9 +464,16 @@ int http_url_request_target_parse(const char *request_target, return -1; } - if (parser->cur != parser->end || auth.enc_userinfo != NULL) { + if (parser->cur != parser->end) { + *error_r = t_strdup_printf( + "Invalid Host header: " + "Contains invalid character %s", + uri_char_sanitize(*parser->cur)); + return -1; + } + if (auth.enc_userinfo != NULL) { *error_r = "Invalid Host header: " - "Contains invalid character"; + "Contains inappropriate 'userinfo@' part"; return -1; }