]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: http-url - Improve error messages by showing which character is unexpected.
authorStephan Bosch <stephan.bosch@open-xchange.com>
Fri, 15 Oct 2021 20:18:06 +0000 (22:18 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 17 Jan 2022 11:52:09 +0000 (13:52 +0200)
src/lib-http/http-url.c

index 229a58a0b3b7feb3306a7f456484d05d0b7dc8b5..4a9e3a85bef11c55e0f55e24b89930003b1741aa 100644 (file)
@@ -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;
                }