Loading src/http.cpp +14 −5 Changes for src/http.cpp: 14 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -3279,16 +3279,25 @@ libhttppp::HttpHeader::HeaderData * libhttppp::HttpHeader::HeaderData::nextHeade } libhttppp::HttpHeader::HeaderData *libhttppp::HttpHeader::getHeaderData(const std ::string &key) const{ auto it = _index.find(key); // HTTP field names are case-insensitive (RFC 7230 §3.2); HeaderData's own // ctor already lowercases _Key, but _index was still keyed by whatever // casing the caller passed in here/to setHeaderData(). A lookup using the // literal wire-parsed key (always lowercase, see parseH1/parseH2/parseH3) // matched fine, but any caller spelling it "Range"/"ETag"/etc. -- exactly // how these are conventionally written -- silently never found a header // that was actually present. Normalize here so lookup matches storage // regardless of the casing either side happens to use. auto it = _index.find(tolower_copy(key)); return (it != _index.end()) ? it->second : nullptr; } libhttppp::HttpHeader::HeaderData * libhttppp::HttpHeader::setHeaderData(const std ::string &key){ auto it = _index.find(key); std::string normKey = tolower_copy(key); auto it = _index.find(normKey); if (it != _index.end()) { HeaderData *curdat = it->second; curdat->clear(); curdat->_Key = key; curdat->_Key = normKey; return curdat; } Loading @@ -3301,12 +3310,12 @@ libhttppp::HttpHeader::HeaderData * libhttppp::HttpHeader::setHeaderData(const s _lastHeaderData->_nextHeaderData = std::move(node); _lastHeaderData = _lastHeaderData->_nextHeaderData.get(); } _index[key] = curdat; _index[normKey] = curdat; return curdat; } void libhttppp::HttpHeader::deldata(const std::string& key){ auto it = _index.find(key); auto it = _index.find(tolower_copy(key)); if (it != _index.end()) deldata(it->second); } Loading Loading
src/http.cpp +14 −5 Changes for src/http.cpp: 14 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -3279,16 +3279,25 @@ libhttppp::HttpHeader::HeaderData * libhttppp::HttpHeader::HeaderData::nextHeade } libhttppp::HttpHeader::HeaderData *libhttppp::HttpHeader::getHeaderData(const std ::string &key) const{ auto it = _index.find(key); // HTTP field names are case-insensitive (RFC 7230 §3.2); HeaderData's own // ctor already lowercases _Key, but _index was still keyed by whatever // casing the caller passed in here/to setHeaderData(). A lookup using the // literal wire-parsed key (always lowercase, see parseH1/parseH2/parseH3) // matched fine, but any caller spelling it "Range"/"ETag"/etc. -- exactly // how these are conventionally written -- silently never found a header // that was actually present. Normalize here so lookup matches storage // regardless of the casing either side happens to use. auto it = _index.find(tolower_copy(key)); return (it != _index.end()) ? it->second : nullptr; } libhttppp::HttpHeader::HeaderData * libhttppp::HttpHeader::setHeaderData(const std ::string &key){ auto it = _index.find(key); std::string normKey = tolower_copy(key); auto it = _index.find(normKey); if (it != _index.end()) { HeaderData *curdat = it->second; curdat->clear(); curdat->_Key = key; curdat->_Key = normKey; return curdat; } Loading @@ -3301,12 +3310,12 @@ libhttppp::HttpHeader::HeaderData * libhttppp::HttpHeader::setHeaderData(const s _lastHeaderData->_nextHeaderData = std::move(node); _lastHeaderData = _lastHeaderData->_nextHeaderData.get(); } _index[key] = curdat; _index[normKey] = curdat; return curdat; } void libhttppp::HttpHeader::deldata(const std::string& key){ auto it = _index.find(key); auto it = _index.find(tolower_copy(key)); if (it != _index.end()) deldata(it->second); } Loading