Commit d0991739 authored by jan.koester's avatar jan.koester
Browse files

test

parent 3455b28b
Loading
Loading
Loading
Loading
+16 −19
Original line number Diff line number Diff line
@@ -5141,51 +5141,48 @@ void libhttppp::HttpCookie::setcookie(libhttppp::HttpResponse &curresp,
  }
  HttpHeader::HeaderData *dat=curresp.setHeaderData("set-cookie");

  // A cookie's attributes (Max-Age, Path, SameSite, ...) belong on the same
  // Set-Cookie line as its name=value, joined with "; " -- printHeader() emits
  // one physical line per push_back()'d value (see comment there), so pushing
  // once per *attribute* here used to fan a single cookie out into N separate
  // top-level Set-Cookie headers, each parsed by the browser as its own cookie.
  std::string buf=key;
  buf+="=";
  buf+=value;
  dat->push_back(buf);

  if(!comment.empty()){
    buf="comment=";
    buf+="; comment=";
    buf+=comment;
    dat->push_back(buf);
  }
  if(!domain.empty()){
    buf="domain=";
    buf+="; domain=";
    buf+=domain;
    dat->push_back(buf);
  }
  if(maxage>=0){
    dat->push_back("max-age=" + std::to_string(maxage));
    buf+="; max-age=" + std::to_string(maxage);
  }
  if(!path.empty()){
    buf="path=";
    buf+="; path=";
    buf+=path;
    dat->push_back(buf);
  }
  if(!samesite.empty()){
    buf="sameSite=";
    buf+="; sameSite=";
    buf+=samesite;
    dat->push_back(buf);
  }else{
    buf="sameSite=Lax";
    dat->push_back(buf);
    buf+="; sameSite=Lax";
  }
  if(secure){
    buf="secure";
    buf+=secure;
    dat->push_back(buf);
    buf+="; secure";
  }
  if(!version.empty()){
    buf="version=";
    buf+="; version=";
    buf+=version;
    dat->push_back(buf);
  }

  if(httponly){
    dat->push_back("httponly");
    buf+="; httponly";
  }

  dat->push_back(buf);
}

void libhttppp::HttpCookie::parse(libhttppp::HttpRequest &curreq){