diff --git a/concurrency-webserver/src/spin.c b/concurrency-webserver/src/spin.c index 7f04d6bbb..fc9c8c612 100644 --- a/concurrency-webserver/src/spin.c +++ b/concurrency-webserver/src/spin.c @@ -34,19 +34,19 @@ int main(int argc, char *argv[]) { while ((get_seconds() - t1) < spin_for) sleep(1); double t2 = get_seconds(); - + /* Make the response body */ char content[MAXBUF]; - sprintf(content, "
Welcome to the CGI program (%s)
\r\n", buf); - sprintf(content, "%sMy only purpose is to waste time on the server!
\r\n", content); - sprintf(content, "%sI spun for %.2f seconds
\r\n", content, t2 - t1); - + sprintf(content, "Welcome to the CGI program (%s)
\r\n" + "My only purpose is to waste time on the server!
\r\n" + "I spun for %.2f seconds
\r\n", buf, t2 - t1); + /* Generate the HTTP response */ printf("Content-length: %lu\r\n", strlen(content)); printf("Content-type: text/html\r\n\r\n"); printf("%s", content); fflush(stdout); - + exit(0); } diff --git a/concurrency-webserver/src/wclient.c b/concurrency-webserver/src/wclient.c index ee3977755..238c9a3a7 100644 --- a/concurrency-webserver/src/wclient.c +++ b/concurrency-webserver/src/wclient.c @@ -29,12 +29,12 @@ void client_send(int fd, char *filename) { char buf[MAXBUF]; char hostname[MAXBUF]; - + gethostname_or_die(hostname, MAXBUF); - + /* Form and send the HTTP request */ - sprintf(buf, "GET %s HTTP/1.1\n", filename); - sprintf(buf, "%shost: %s\n\r\n", buf, hostname); + sprintf(buf, "GET %s HTTP/1.1\n" + "host: %s\n\r\n", filename, hostname); write_or_die(fd, buf, strlen(buf)); }