diff options
author | Santo Cariotti <santo@dcariotti.me> | 2021-10-22 23:07:21 +0200 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2021-10-22 23:07:21 +0200 |
commit | 9b660a40642e71a650fa6cff7409521a2b13275a (patch) | |
tree | ee996a959f6051a8a402e092269b998e7527dcb3 | |
parent | 8e60acc147462386b0ad31b03e4a694efabd834f (diff) |
add connection field to response
-rw-r--r-- | Year_3/TSDWL/webserver/server.c | 5 |
1 files changed, 4 insertions, 1 deletions
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)); } |