diff options
author | Santo Cariotti <santo@dcariotti.me> | 2021-10-22 23:08:40 +0200 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2021-10-22 23:08:40 +0200 |
commit | ebbcdae62c9e42d501ef5ab02046761f3be4603b (patch) | |
tree | e34a414cf49d1e7d76a80dd41e72ccc037aa5634 /Year_3/TSDWL/webserver | |
parent | 9b660a40642e71a650fa6cff7409521a2b13275a (diff) |
fix parsing of first header line
Diffstat (limited to 'Year_3/TSDWL/webserver')
-rw-r--r-- | Year_3/TSDWL/webserver/server.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Year_3/TSDWL/webserver/server.c b/Year_3/TSDWL/webserver/server.c index 15c8117..66ca8bf 100644 --- a/Year_3/TSDWL/webserver/server.c +++ b/Year_3/TSDWL/webserver/server.c @@ -355,11 +355,11 @@ main(int argc, char* argv[]) if (headers_num == 0) { buffer = "You must specify almost one header\n"; write(clientfd, buffer, strlen(buffer) + 1); - } - - if (parse_first_line(&request, headers[0], strlen(headers[0])) > -1) { - if (request.method == GET) { - read_file(www_path, &request, clientfd); + } else { + if (parse_first_line(&request, headers[0], strlen(headers[0])) > -1) { + if (request.method == GET) { + read_file(www_path, &request, clientfd); + } } } |