Commit 57c2face authored by jan.koester's avatar jan.koester
Browse files

test

parent ba0657db
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
@@ -846,6 +846,7 @@ const std ::string &libhttppp::HttpResponse::getContentType() const{
}

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

  auto append=[&buffer](const std::string &data){
    buffer.insert(buffer.end(), data.begin(), data.end());
  };
@@ -1299,19 +1300,26 @@ void libhttppp::HttpRequest::printHeader(std::string &buffer){
  buffer.append(" ");
  buffer.append(_RequestVersion);
  buffer.append("\r\n");

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

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

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

// CONCEPTUAL IMPROVEMENT FOR POST:
// For POST requests, ensure you call setHeaderData("Content-Length", value)
// before calling printHeader, where value is the size of the request body.


int libhttppp::HttpRequest::getRequestType(){
  return _RequestType;