Loading test/http.cpp +3 −15 Changes for test/http.cpp: 3 added lines, 15 removed lines. Original line number Diff line number Diff line Loading @@ -20,8 +20,6 @@ class MyServer : public event { } void RequestEvent(con &curcon, const int tid, ULONG_PTR args) override { std::cerr << "[SERVER] RequestEvent called, RecvData.size()=" << curcon.RecvData.size() << std::endl; const std::string body = "Hello world\n"; std::string resp; resp += "HTTP/1.1 200 OK\r\n"; Loading @@ -38,7 +36,6 @@ class MyServer : public event { } void ConnectEvent(con &curcon, const int tid, ULONG_PTR args) override { std::cerr << "[SERVER] ConnectEvent called" << std::endl; } void DisconnectEvent(con &curcon, const int tid, ULONG_PTR args) override { Loading @@ -62,18 +59,16 @@ int main() { srv.runEventloop(); }); // Give the server a moment to start listening std::this_thread::sleep_for(std::chrono::milliseconds(2000)); // Give the server time to start the event loop std::this_thread::sleep_for(std::chrono::milliseconds(500)); int result = 1; // default = failure try { // Connect a client tcp client; std::cerr << "[DEBUG] Connecting..." << std::endl; client.connect("127.0.0.1", 8080); std::cerr << "[DEBUG] Connected, fd=" << client.fd() << std::endl; client.setTimeout(5000); // 5 second recv/send timeout client.setTimeout(5000); // Send an HTTP request const std::string request = Loading @@ -85,8 +80,6 @@ int main() { buffer sendbuf(request.data(), request.size()); client.sendData(sendbuf); std::cerr << "[DEBUG] Request sent, reading response..." << std::endl; // Read the response (with timeout protection) std::string response; for (;;) { Loading @@ -94,12 +87,7 @@ int main() { size_t n = 0; try { n = client.recvData(recvbuf); } catch (netplus::NetException &ne) { std::cerr << "[DEBUG] recvData NetException: " << ne.what() << " type=" << ne.getErrorType() << std::endl; break; } catch (...) { std::cerr << "[DEBUG] recvData unknown exception" << std::endl; break; } if (n == 0) break; Loading Loading
test/http.cpp +3 −15 Changes for test/http.cpp: 3 added lines, 15 removed lines. Original line number Diff line number Diff line Loading @@ -20,8 +20,6 @@ class MyServer : public event { } void RequestEvent(con &curcon, const int tid, ULONG_PTR args) override { std::cerr << "[SERVER] RequestEvent called, RecvData.size()=" << curcon.RecvData.size() << std::endl; const std::string body = "Hello world\n"; std::string resp; resp += "HTTP/1.1 200 OK\r\n"; Loading @@ -38,7 +36,6 @@ class MyServer : public event { } void ConnectEvent(con &curcon, const int tid, ULONG_PTR args) override { std::cerr << "[SERVER] ConnectEvent called" << std::endl; } void DisconnectEvent(con &curcon, const int tid, ULONG_PTR args) override { Loading @@ -62,18 +59,16 @@ int main() { srv.runEventloop(); }); // Give the server a moment to start listening std::this_thread::sleep_for(std::chrono::milliseconds(2000)); // Give the server time to start the event loop std::this_thread::sleep_for(std::chrono::milliseconds(500)); int result = 1; // default = failure try { // Connect a client tcp client; std::cerr << "[DEBUG] Connecting..." << std::endl; client.connect("127.0.0.1", 8080); std::cerr << "[DEBUG] Connected, fd=" << client.fd() << std::endl; client.setTimeout(5000); // 5 second recv/send timeout client.setTimeout(5000); // Send an HTTP request const std::string request = Loading @@ -85,8 +80,6 @@ int main() { buffer sendbuf(request.data(), request.size()); client.sendData(sendbuf); std::cerr << "[DEBUG] Request sent, reading response..." << std::endl; // Read the response (with timeout protection) std::string response; for (;;) { Loading @@ -94,12 +87,7 @@ int main() { size_t n = 0; try { n = client.recvData(recvbuf); } catch (netplus::NetException &ne) { std::cerr << "[DEBUG] recvData NetException: " << ne.what() << " type=" << ne.getErrorType() << std::endl; break; } catch (...) { std::cerr << "[DEBUG] recvData unknown exception" << std::endl; break; } if (n == 0) break; Loading