diff --git a/concurrency-webserver/src/wclient.c b/concurrency-webserver/src/wclient.c index ee3977755..9d12eb6b3 100644 --- a/concurrency-webserver/src/wclient.c +++ b/concurrency-webserver/src/wclient.c @@ -59,10 +59,13 @@ void client_print(int fd) { } // Read and display the HTTP Body - n = readline_or_die(fd, buf, MAXBUF); + int capacity = sizeof(buf) - 1; + n = read_or_die(fd, buf, capacity); while (n > 0) { - printf("%s", buf); - n = readline_or_die(fd, buf, MAXBUF); + buf[n] = '\0'; + printf("%s", buf); + + n = read_or_die(fd, buf, capacity); } }