Merge ff652715548d7c5c4b4f7a000141936193172666 into e523d7223b5589e68de2c2a9428a4ba81a265e6f

This commit is contained in:
huiming 2025-09-22 18:03:51 +05:30 committed by GitHub
commit 6bd6a31436
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -411,14 +411,14 @@ int Transaction::processURI(const char *uri, const char *method,
if (!m_uri_decoded.empty() && m_uri_decoded[0] != '/') { if (!m_uri_decoded.empty() && m_uri_decoded[0] != '/') {
bool fullDomain = true; bool fullDomain = true;
size_t scheme = m_uri_decoded.find(":")+1; size_t scheme = m_uri_decoded.find(":")+1;
if (scheme == std::string::npos) { if (scheme == std::string::npos) { //impossible case, for +1 in size_t scheme = m_uri_decoded.find(":")+1
fullDomain = false; fullDomain = false;
} }
// Searching with a pos of -1 is undefined we also shortcut // Searching with a pos of -1 is undefined we also shortcut
if (scheme != std::string::npos && fullDomain == true) { if (scheme != std::string::npos && fullDomain == true) {
// Assuming we found a colon make sure its followed // Assuming we found a colon make sure its followed
size_t netloc = m_uri_decoded.find("//", scheme) + 2; size_t netloc = m_uri_decoded.find("//", scheme) + 2;//
if (netloc == std::string::npos || (netloc != scheme + 2)) { if (netloc == std::string::npos || (netloc != scheme + 2)) { //(netloc == std::string::npos) will be false forever, for +2 in size_t netloc = m_uri_decoded.find("//", scheme) + 2
fullDomain = false; fullDomain = false;
} }
if (netloc != std::string::npos && fullDomain == true) { if (netloc != std::string::npos && fullDomain == true) {