diff --git a/client.hpp b/client.hpp index 0df7248..88bfb5b 100644 --- a/client.hpp +++ b/client.hpp @@ -261,7 +261,7 @@ class HTTPClient return sockfd; } - static void getFile(std::string uri) + static std::string getFile(std::string uri) { struct uri websiteURI = parseURI(uri); int port = websiteURI.port == -1 ? 80 : websiteURI.port; @@ -298,6 +298,6 @@ class HTTPClient response.parse(std::string(buffer)); } - std::cout << response.getHeaderString() << std::endl; + return response.body; } }; diff --git a/test b/test index e469872..0889769 100755 Binary files a/test and b/test differ diff --git a/test.cpp b/test.cpp index be1b9ad..df1d0b8 100644 --- a/test.cpp +++ b/test.cpp @@ -3,6 +3,6 @@ int main() { - HTTPClient::getFile("http://neverssl.com/"); + std::cout << HTTPClient::getFile("http://neverssl.com/") << std::endl; return 0; }