From 9b660a40642e71a650fa6cff7409521a2b13275a Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Fri, 22 Oct 2021 23:07:21 +0200 Subject: add connection field to response --- Year_3/TSDWL/webserver/server.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Year_3/TSDWL') diff --git a/Year_3/TSDWL/webserver/server.c b/Year_3/TSDWL/webserver/server.c index ff9a5bf..15c8117 100644 --- a/Year_3/TSDWL/webserver/server.c +++ b/Year_3/TSDWL/webserver/server.c @@ -278,7 +278,10 @@ read_file(char* root, request_t* request, int client) sprintf(buffer, "Content-Length: %ld\n", sb.st_size); write(client, buffer, strlen(buffer)); - sprintf(buffer, "Last-Modified: %s\n", ctime(&sb.st_mtime)); + sprintf(buffer, "Last-Modified: %s", ctime(&sb.st_mtime)); + write(client, buffer, strlen(buffer)); + + sprintf(buffer, "Connection: close\n\n"); write(client, buffer, strlen(buffer)); } -- cgit v1.2.3-18-g5258