Commit 90489bad authored by jan.koester's avatar jan.koester
Browse files

some fixes

parent 2f8fd43f
Loading
Loading
Loading
Loading
+12 −1
Changes for .kdev4/libhttppp.kdev4: 12 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -2,8 +2,9 @@
BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x12\x00l\x00i\x00b\x00h\x00t\x00t\x00p\x00p\x00p)

[CMake]
Build Directory Count=1
Build Directory Count=2
Current Build Directory Index-Host System=0
Current Build Directory Index-Host-System=1

[CMake][CMake Build Directory 0]
Build Directory Path=/home/jan.koester/Projects/libhttppp/build
@@ -15,5 +16,15 @@ Extra Arguments=
Install Directory=/usr/local
Runtime=Host System

[CMake][CMake Build Directory 1]
Build Directory Path=/home/intranet.tuxist.de/jan.koester/Projects/libhttppp/build
Build Type=
CMake Binary=/usr/bin/cmake
CMake Executable=/usr/bin/cmake
Environment Profile=
Extra Arguments=
Install Directory=/usr/local
Runtime=Host-System

[Project]
VersionControlSupport=kdevgit
+8 −6
Changes for examples/httpclient.cpp: 8 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -80,9 +80,10 @@ size_t readchunk(const char *data,size_t datasize,size_t &pos){
int main(int argc, char** argv){
  signal(SIGPIPE, SIG_IGN);
  netplus::socket *cltsock=nullptr;
  netplus::tcp    *srvsock=nullptr;
  try{
    netplus::tcp srvsock(argv[1],atoi(argv[2]),1,0);
    cltsock=srvsock.connect();
    srvsock= new netplus::tcp(argv[1],atoi(argv[2]),1,0);
    cltsock=srvsock->connect();

    try{
      libhttppp::HttpRequest req;
@@ -93,14 +94,14 @@ int main(int argc, char** argv){
      *req.setData("host") << argv[1] << ":" << argv[2];
      *req.setData("accept") << "text/html";
      *req.setData("user-agent") << "libhttppp/1.0 (Alpha Version 0.1)";
      req.send(cltsock,&srvsock);
      req.send(cltsock,srvsock);
    }catch(libhttppp::HTTPException &e){
      std::cerr << e.what() << std::endl;
      return -1;
    }

    char data[16384];
    size_t recv=cltsock->recvData(&srvsock,data,16384);
    size_t recv=srvsock->recvData(cltsock,data,16384);

    std::string html;
    libhttppp::HttpResponse res;
@@ -125,7 +126,7 @@ int main(int argc, char** argv){
            html.append(data+hsize,recv-hsize);
            rlen-=recv-hsize;
            if(rlen>0){
              recv=cltsock->recvData(&srvsock,data,16384);
              recv=srvsock->recvData(cltsock,data,16384);
              hsize=0;
            }
        }while(rlen>0);
@@ -135,12 +136,13 @@ int main(int argc, char** argv){
            html.append(data+cpos,chunklen);
            cpos+=chunklen;
            if(recv<chunklen){
              recv=cltsock->recvData(&srvsock,data,16384);
              recv=srvsock->recvData(cltsock,data,16384);
              cpos=0;
            }
        }while((chunklen=readchunk(data,recv,cpos))!=0);
    }
    delete cltsock;
    delete srvsock;
    if(!html.empty())
      std::cout << html << std::endl;
    return 0;
+2 −2
Changes for src/http.cpp: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -633,10 +633,10 @@ void libhttppp::HttpRequest::send(netplus::socket* src,netplus::socket* dest){
  printHeader(header);

  try {
    size_t send=src->sendData(dest,(void*)header.c_str(),header.length());
    size_t send=dest->sendData(src,(void*)header.c_str(),header.length());

    while(send<_Request.length()){
      send+=src->sendData(dest,(void*)_Request.substr(send,_Request.length()-send).c_str(),
      send+=dest->sendData(src,(void*)_Request.substr(send,_Request.length()-send).c_str(),
                          _Request.length()-send);
    }
  }catch(netplus::NetException &e){