Commit 656d22ff authored by Jan Koester's avatar Jan Koester
Browse files

test

parent efe48932
Loading
Loading
Loading
Loading
+9 −1
Changes for src/http.cpp: 9 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -5318,7 +5318,15 @@ void libhttppp::HttpCookie::setcookie(libhttppp::HttpResponse &curresp,
  // used to fan a single cookie out into N separate top-level Set-Cookie headers,
  // each parsed by the browser as its own cookie. Chain onto the one Values node
  // this call owns instead of pushing a new one per attribute.
  HttpHeader::HeaderData::Values &val = curresp.setHeaderData("set-cookie")->push_back(key + "=" + value);
  //
  // Reuse the existing "set-cookie" HeaderData rather than setHeaderData(),
  // which clears any values already stored under that key -- a second
  // setcookie() call on the same response (e.g. sessionid then authid) would
  // otherwise wipe out the first cookie before it ever reaches the browser.
  HttpHeader::HeaderData *cookieHeader = curresp.getHeaderData("set-cookie");
  if(!cookieHeader)
    cookieHeader = curresp.setHeaderData("set-cookie");
  HttpHeader::HeaderData::Values &val = cookieHeader->push_back(key + "=" + value);

  if(!comment.empty())
    val << "; comment=" << comment;