From 28ab1230e2a97f9693eac1d9d7f32681b7a9f9fd Mon Sep 17 00:00:00 2001 From: xcps Date: Thu, 30 Jun 2016 07:59:58 -0400 Subject: [PATCH] '@' can exist in url path --- HTTP.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/HTTP.cpp b/HTTP.cpp index 31567bbd..7fd87c55 100644 --- a/HTTP.cpp +++ b/HTTP.cpp @@ -81,7 +81,8 @@ namespace http { } /* user[:pass] */ pos_c = url.find('@', pos_p); - if (pos_c != std::string::npos) { + std::size_t pos_slash = url.find('/', pos_p); + if (pos_c != std::string::npos && (pos_slash == std::string::npos || pos_slash > pos_c)) { std::size_t delim = url.find(':', pos_p); if (delim != std::string::npos && delim < pos_c) { user = url.substr(pos_p, delim - pos_p); @@ -90,7 +91,7 @@ namespace http { } else { user = url.substr(pos_p, pos_c - pos_p); } - pos_p = pos_c + 1; + pos_p = pos_c + 1; } /* hostname[:port][/path] */ pos_c = url.find_first_of(":/", pos_p);