Loading src/http.cpp +15 −12 Original line number Diff line number Diff line Loading @@ -3565,17 +3565,19 @@ size_t libhttppp::HttpResponse::printHeader(std::vector<char> &buffer){ append(_State); append("\r\n"); // One "Key: value\r\n" line per value, never folded onto a single line: valid per RFC 7230 // Sec3.2.2 for any header, and *required* for Set-Cookie specifically (RFC 6265 Sec3), whose // values may themselves contain ";" and "," (e.g. "Expires=Wed, 21 Oct 2025 07:28:00 GMT") // -- joining two such values with "; " produces one line no client can parse back apart, // silently breaking any response that sets more than one cookie. for(HeaderData *curdat=getfirstHeaderData(); curdat; curdat=curdat->nextHeaderData()){ for(HeaderData::Values *cval=curdat->getfirstValue(); cval; cval=cval->nextvalue()){ append(curdat->getkey()); append(": "); for(HeaderData::Values *cval=curdat->getfirstValue(); cval; cval=cval->nextvalue()){ append(cval->getvalue()); if(cval->nextvalue()) append("; "); } append("\r\n"); } } append("\r\n"); return buffer.size(); Loading Loading @@ -4421,21 +4423,22 @@ void libhttppp::HttpRequest::printHeader(std::string &buffer){ buffer.append(_cachedRequestVersion); buffer.append("\r\n"); // One "Key: value\r\n" line per value -- see HttpResponse::printHeader's twin above for why // folding multiple values of the same header onto one "; "-joined line is wrong (breaks any // multi-instance header whose values may contain ";"/",", not just Set-Cookie, which never // appears on a request but the same serialization is shared logic). for(HeaderData *curdat=getfirstHeaderData(); curdat; curdat=curdat->nextHeaderData()){ // Skip pseudo-headers and response pseudo-headers in H1 output const std::string &key = curdat->getkey(); if (!key.empty() && key[0] == ':') continue; for(HeaderData::Values *cval=curdat->getfirstValue(); cval; cval=cval->nextvalue()){ buffer.append(key); buffer.append(": "); for(HeaderData::Values *cval=curdat->getfirstValue(); cval; cval=cval->nextvalue()){ buffer.append(cval->getvalue()); if(cval->nextvalue()) buffer.append("; "); } buffer.append("\r\n"); } } buffer.append("\r\n"); } Loading Loading
src/http.cpp +15 −12 Original line number Diff line number Diff line Loading @@ -3565,17 +3565,19 @@ size_t libhttppp::HttpResponse::printHeader(std::vector<char> &buffer){ append(_State); append("\r\n"); // One "Key: value\r\n" line per value, never folded onto a single line: valid per RFC 7230 // Sec3.2.2 for any header, and *required* for Set-Cookie specifically (RFC 6265 Sec3), whose // values may themselves contain ";" and "," (e.g. "Expires=Wed, 21 Oct 2025 07:28:00 GMT") // -- joining two such values with "; " produces one line no client can parse back apart, // silently breaking any response that sets more than one cookie. for(HeaderData *curdat=getfirstHeaderData(); curdat; curdat=curdat->nextHeaderData()){ for(HeaderData::Values *cval=curdat->getfirstValue(); cval; cval=cval->nextvalue()){ append(curdat->getkey()); append(": "); for(HeaderData::Values *cval=curdat->getfirstValue(); cval; cval=cval->nextvalue()){ append(cval->getvalue()); if(cval->nextvalue()) append("; "); } append("\r\n"); } } append("\r\n"); return buffer.size(); Loading Loading @@ -4421,21 +4423,22 @@ void libhttppp::HttpRequest::printHeader(std::string &buffer){ buffer.append(_cachedRequestVersion); buffer.append("\r\n"); // One "Key: value\r\n" line per value -- see HttpResponse::printHeader's twin above for why // folding multiple values of the same header onto one "; "-joined line is wrong (breaks any // multi-instance header whose values may contain ";"/",", not just Set-Cookie, which never // appears on a request but the same serialization is shared logic). for(HeaderData *curdat=getfirstHeaderData(); curdat; curdat=curdat->nextHeaderData()){ // Skip pseudo-headers and response pseudo-headers in H1 output const std::string &key = curdat->getkey(); if (!key.empty() && key[0] == ':') continue; for(HeaderData::Values *cval=curdat->getfirstValue(); cval; cval=cval->nextvalue()){ buffer.append(key); buffer.append(": "); for(HeaderData::Values *cval=curdat->getfirstValue(); cval; cval=cval->nextvalue()){ buffer.append(cval->getvalue()); if(cval->nextvalue()) buffer.append("; "); } buffer.append("\r\n"); } } buffer.append("\r\n"); } Loading