Commit 2161a978 authored by jan.koester's avatar jan.koester
Browse files

test

parent 95322834
Loading
Loading
Loading
Loading
+15 −11
Changes for src/http.cpp: 15 added lines, 11 removed lines.
Original line number Diff line number Diff line
@@ -1633,21 +1633,25 @@ void libhttppp::HttpRequest::send(netplus::socket &dest){
    std::string header;
    printHeader(header);

  try {
    netplus::buffer data(header.c_str(),header.length());
    size_t send=dest.sendData(data);
    std::string full = header + _Request;
    size_t off = 0;

    while(send<_Request.length()){
      netplus::buffer sendpart(_Request.substr(send,_Request.length()-send).c_str(),_Request.length()-send);
      send+=dest.sendData(sendpart);
    }
    while (off < full.size()) {
        try {
            netplus::buffer chunk(full.data() + off, full.size() - off);
            size_t n = dest.sendData(chunk);
            off += n;
        } catch (netplus::NetException& e) {
    HTTPException excep;
    excep[HTTPException::Error] << "RequestSend Socket Error: " << e.what();
    throw excep;
            if (e.getErrorType() == netplus::NetException::Note) {
                // nonblocking: caller must retry later (EPOLLOUT)
                return;
            }
            HTTPException ex;
            ex[HTTPException::Error] << "RequestSend Socket Error: " << e.what();
            throw ex;
        }
    }
}


void libhttppp::HttpRequest::setRequestType(int req){
  if(req == POSTREQUEST || req == GETREQUEST){