Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Chengjie-Huang committed May 30, 2022
1 parent f9b11f9 commit 15c93c3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions apps/webget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void get_URL(const string &host, const string &path) {
// then request the URL path given in the "path" string.
TCPSocket socket;
socket.connect(Address(host, "http"));
socket.write("Get " + path + "HTTP/1.1\r\n");
socket.write("Get " + path + " HTTP/1.1\r\nHOST: " + host + "\r\n" + "Connection: close\r\n");
auto recvd = socket.read();

// Then you'll need to print out everything the server sends back,
Expand All @@ -25,7 +25,6 @@ void get_URL(const string &host, const string &path) {
recvd = socket.read();
}

socket.write("Connection: close\r\n");
socket.close();
}

Expand Down

0 comments on commit 15c93c3

Please sign in to comment.