From 6dd84564cf2ff5a299eebe2f50576c3c3623ae77 Mon Sep 17 00:00:00 2001 From: ridethepig Date: Fri, 17 Feb 2023 15:44:38 +0000 Subject: [PATCH] webget done --- apps/webget.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/webget.cc b/apps/webget.cc index 4f4a3e9..e24af2f 100644 --- a/apps/webget.cc +++ b/apps/webget.cc @@ -1,4 +1,5 @@ -#include "socket.hh" +// #include "socket.hh" +#include "tcp_sponge_socket.hh" #include "util.hh" #include @@ -16,7 +17,7 @@ void get_URL(const string &host, const string &path) { // Then you'll need to print out everything the server sends back, // (not just one call to read() -- everything) until you reach // the "eof" (end of file). - TCPSocket sock; + CS144TCPSocket sock; sock.connect(Address(host, "http")); string request = "GET " + path + " HTTP/1.1\r\nHost: " + host + "\r\nConnection: close\r\n\r\n"; sock.write(request); @@ -25,6 +26,7 @@ void get_URL(const string &host, const string &path) { cout << recvd; recvd = sock.read(); } + sock.wait_until_closed(); // cerr << "Function called: get_URL(" << host << ", " << path << ").\n"; // cerr << "Warning: get_URL() has not been implemented yet.\n"; }