cs-3516-assignment-1/server/request_handling.h

24 lines
520 B
C
Raw Normal View History

2018-09-09 03:53:54 +00:00
#ifndef REQUEST_HANDLING_H
#define REQUEST_HANDLING_H
2018-09-09 18:48:48 +00:00
#include <stdio.h>
2018-09-11 00:18:00 +00:00
enum file_result{RESULT_IO_ERROR, RESULT_NOT_FILE, RESULT_FILE_OK};
2018-09-09 03:53:54 +00:00
struct request_line {
char *http_version;
char *method;
char *uri;
};
2018-09-09 18:48:48 +00:00
struct requested_file {
long size;
FILE *file;
};
2018-09-09 03:53:54 +00:00
int parse_request_line(const char *line, struct request_line *parsed_line);
2018-09-10 00:54:19 +00:00
void free_request_line_items(struct request_line *parsed_line);
2018-09-11 00:18:00 +00:00
enum file_result get_file_from_uri(const char *uri, struct requested_file *req_file);
2018-09-09 03:53:54 +00:00
#endif