From 9e4f93d87e744c9038554d19f3837980959093e2 Mon Sep 17 00:00:00 2001 From: Zhenlin Huang Date: Mon, 17 Jun 2024 23:44:51 +0800 Subject: [PATCH] Allow hex for ipv6 literal addr in redirect (#1859) Co-authored-by: jaredhuang --- httplib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httplib.h b/httplib.h index b1b3f7d..0085a39 100644 --- a/httplib.h +++ b/httplib.h @@ -7275,7 +7275,7 @@ inline bool ClientImpl::redirect(Request &req, Response &res, Error &error) { if (location.empty()) { return false; } const static std::regex re( - R"((?:(https?):)?(?://(?:\[([\d:]+)\]|([^:/?#]+))(?::(\d+))?)?([^?#]*)(\?[^#]*)?(?:#.*)?)"); + R"((?:(https?):)?(?://(?:\[([a-fA-F\d:]+)\]|([^:/?#]+))(?::(\d+))?)?([^?#]*)(\?[^#]*)?(?:#.*)?)"); std::smatch m; if (!std::regex_match(location, m, re)) { return false; }