Skip to content

Commit

Permalink
Removed example code and used the http_get function to request the in…
Browse files Browse the repository at this point in the history
…dex page of the server
  • Loading branch information
skelly authored and lil-skelly committed Sep 4, 2024
1 parent 3d05dd2 commit 1816292
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/client/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
int main() {
struct addrinfo hints, *ainfo;
int sfd; // socket file descriptor
http_res_t response;
http_res_t fraction_links_resp;

setup_hints(&hints);

Expand All @@ -25,17 +25,13 @@ int main() {
return EXIT_FAILURE;
}

// make multuple requests using the same connection
for (int i = 0; i < 10; ++i) {
if (HTTP_SUCCESS != http_get(sfd, "/hello", &response)) {
if (HTTP_SUCCESS != http_get(sfd, "/", &fraction_links_resp)) {
return EXIT_FAILURE;
}
}
write(1, response.data, response.size);
http_free(&response);
}

close(sfd);


close(sfd);
return EXIT_SUCCESS;
}

0 comments on commit 1816292

Please sign in to comment.