diff --git a/server/socket_server.c b/server/socket_server.c index 0921a64..e4b1cbc 100644 --- a/server/socket_server.c +++ b/server/socket_server.c @@ -203,10 +203,10 @@ static enum request_parse_result parse_and_validate_request(struct http_message int parse_result = parse_request_line(message.start_line, req_line); if (parse_result == -1) { return PARSE_RESULT_MALFORMED; - } else if (strcmp(req_line->method, "GET") != 0) { - return PARSE_RESULT_BAD_METHOD; } else if (strcmp(req_line->http_version, HTTP_VERSION) != 0) { return PARSE_RESULT_BAD_VERSION; + } else if (strcmp(req_line->method, "GET") != 0) { + return PARSE_RESULT_BAD_METHOD; } return PARSE_RESULT_OK; @@ -256,10 +256,10 @@ enum socket_result serve_one_request(int sock_fd) { int status_code = 500; if (parse_result == PARSE_RESULT_MALFORMED) { status_code = 400; - } else if (parse_result == PARSE_RESULT_BAD_METHOD) { - status_code = 405; } else if (parse_result == PARSE_RESULT_BAD_VERSION) { status_code = 505; + } else if (parse_result == PARSE_RESULT_BAD_METHOD) { + status_code = 405; } send_headers(status_code, client_fd, -1); free_request_line_items(&parsed_request_line);