diff options
author | Matt Strapp <strap012@umn.edu> | 2020-12-06 17:55:34 -0600 |
---|---|---|
committer | Matt Strapp <strap012@umn.edu> | 2020-12-06 17:55:34 -0600 |
commit | ddc3edca9e3815011892839366148082b9acc0d5 (patch) | |
tree | 461b50381deedf05a4bc95667aa2e178509ffb10 | |
parent | fix makefile and finish P4??? (diff) | |
download | csci4061-ddc3edca9e3815011892839366148082b9acc0d5.tar csci4061-ddc3edca9e3815011892839366148082b9acc0d5.tar.gz csci4061-ddc3edca9e3815011892839366148082b9acc0d5.tar.bz2 csci4061-ddc3edca9e3815011892839366148082b9acc0d5.tar.lz csci4061-ddc3edca9e3815011892839366148082b9acc0d5.tar.xz csci4061-ddc3edca9e3815011892839366148082b9acc0d5.tar.zst csci4061-ddc3edca9e3815011892839366148082b9acc0d5.zip |
NOT CLEAR. I AM A MORON.
-rw-r--r-- | P4/util.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -71,7 +71,8 @@ int accept_connection(void) { if ((new_socket = accept(sockfd, (struct sockaddr *)&address, (socklen_t*)&addrlen))<0) { perror("Accept"); return -1; - }; + } + printf("%d\n", new_socket); return(new_socket); } @@ -92,6 +93,7 @@ int accept_connection(void) { specific 'connection'. ************************************************/ int get_request(int fd, char *filename) { + printf("%d\n", fd); char buffer[2048] = "\0"; char get[100], http[100]; @@ -99,7 +101,6 @@ int get_request(int fd, char *filename) { read(fd, buffer, 2048); printf("%s\n", buffer); if(sscanf(buffer, "%s %s %s", get, filename, http) < 2) { // Read HTTP Get request and parse - perror("Cannot parse request"); return -1; } else if (strcmp(get, "GET")) { @@ -140,6 +141,7 @@ int get_request(int fd, char *filename) { ************************************************/ int return_result(int fd, char *content_type, char *buf, int numbytes) { //Convert low IO to high IO + printf("%d\n", fd); FILE *fdstream = fdopen(fd, "w"); if (fdstream == NULL) { printf("File stream conversion(?) failed.\n"); @@ -179,6 +181,7 @@ int return_result(int fd, char *content_type, char *buf, int numbytes) { - returns 0 on success, nonzero on failure. ************************************************/ int return_error(int fd, char *buf) { + printf("%d\n", fd); //Convert low IO to high IO FILE *fdstream = fdopen(fd, "w"); if (fdstream == NULL) { |