Allow hex for ipv6 literal addr in redirect (#1859)

Co-authored-by: jaredhuang <jaredhuang@tencent.com>
This commit is contained in:
Zhenlin Huang 2024-06-17 23:44:51 +08:00 committed by GitHub
parent 0b657d28cf
commit 9e4f93d87e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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; }