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

test

parent 965620e6
Loading
Loading
Loading
Loading
+7 −5
Changes for src/http.cpp: 7 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -846,27 +846,29 @@ const std ::string &libhttppp::HttpResponse::getContentType() const{
}

size_t libhttppp::HttpResponse::printHeader(std::vector<char> &buffer){

  auto append=[&buffer](const std::string &data){
    for(size_t i=0; i<data.length(); ++i){
      buffer.push_back(data[i]);
    }
    buffer.insert(buffer.end(), data.begin(), data.end());
  };

  append(_Version);
  append(" ");
  append(_State);
  append(" ");
  append("OK");
  append("\r\n");

  for(HeaderData *curdat=getfirstHeaderData(); curdat; curdat=curdat->nextHeaderData()){
    append(curdat->getkey());
    append(": ");

    for(HeaderData::Values *cval=curdat->getfirstValue(); cval; cval=cval->nextvalue()){
      append(cval->getvalue());
      if(cval->nextvalue())
        append("; ");
        append(", ");
    }
    append("\r\n");
  }

  append("\r\n");
  return buffer.size();
}