Commit 522eb344 authored by jan.koester's avatar jan.koester
Browse files

clean

parent 28ff5f79
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -2598,18 +2598,6 @@ void libhttppp::HttpRequest::setRequestURL(const std::string &url){

void libhttppp::HttpForm::parse(libhttppp::HttpRequest &request){
  if(request.getRequestType()==POSTREQUEST){
    // Debug: dump all headers
    std::cerr << "[DEBUG HttpForm::parse] dumping headers:" << std::endl;
    for(auto *hd = request.getfirstHeaderData(); hd; hd = hd->nextHeaderData()){
      std::cerr << "  key='" << hd->getkey() << "' values:";
      for(auto *v = hd->getfirstValue(); v; v = v->nextvalue()){
        std::cerr << " '" << v->getvalue() << "'";
      }
      std::cerr << std::endl;
    }
    std::cerr << "[DEBUG] RecvData.size()=" << request.RecvData.size()
              << " ContentLength=" << request.getContentLength() << std::endl;

    HttpHeader::HeaderData *ctype=request.getHeaderData("content-type");

    if(!ctype){
+0 −13
Original line number Diff line number Diff line
@@ -733,22 +733,13 @@ REQUESTHANDLING:
                break;
            case POSTREQUEST: {
                size_t clen = cureq.getContentLength();
                std::cerr << "[DEBUG POST] clen=" << clen
                          << " RecvData.size()=" << cureq.RecvData.size() << std::endl;
                if(clen == 0){
                    // No Content-Length or zero-length body: dispatch immediately
                    // without waiting for body data
                    std::cerr << "[DEBUG POST] clen==0, dispatching immediately" << std::endl;
                    RequestEvent(cureq,tid,args);
                    cureq._RequestType=PARSEREQUEST;
                } else if(cureq.RecvData.size()>=clen){
                    std::cerr << "[DEBUG POST] body complete, dispatching" << std::endl;
                    RequestEvent(cureq,tid,args);
                    cureq.RecvData.erase(cureq.RecvData.begin(),cureq.RecvData.begin()+clen);
                    cureq._RequestType=PARSEREQUEST;
                    std::cerr << "[DEBUG POST] dispatched, RequestType=PARSEREQUEST" << std::endl;
                } else {
                    std::cerr << "[DEBUG POST] waiting for more body data" << std::endl;
                }
                break;
            }
@@ -798,16 +789,12 @@ void libhttppp::HttpEvent::ResponseEvent(netplus::con &curcon,const int tid,ULON
        // partially received body to be re-parsed as HTTP headers, which
        // leads to an endless loop for large/multi-file uploads).
        if (cureq.getRequestType() == POSTREQUEST) {
            std::cerr << "[DEBUG RESP] skipping: still POSTREQUEST" << std::endl;
            return;
        }
        if (cureq.getRequestType() == PARSEREQUEST && cureq.getRequestURL().empty()) {
            return;
        }

        std::cerr << "[DEBUG RESP] type=" << cureq.getRequestType()
                  << " url='" << cureq.getRequestURL() << "'"
                  << " SendData.size()=" << cureq.SendData.size() << std::endl;
        ResponseEvent(cureq,tid,args);
        if(cureq.SendData.empty()){
            cureq.SendData.pos=0;