24 lines
520 B
C
24 lines
520 B
C
#ifndef REQUEST_HANDLING_H
|
|
#define REQUEST_HANDLING_H
|
|
|
|
#include <stdio.h>
|
|
|
|
enum file_result{RESULT_IO_ERROR, RESULT_NOT_FILE, RESULT_FILE_OK};
|
|
|
|
struct request_line {
|
|
char *http_version;
|
|
char *method;
|
|
char *uri;
|
|
};
|
|
|
|
struct requested_file {
|
|
long size;
|
|
FILE *file;
|
|
};
|
|
|
|
int parse_request_line(const char *line, struct request_line *parsed_line);
|
|
void free_request_line_items(struct request_line *parsed_line);
|
|
enum file_result get_file_from_uri(const char *uri, struct requested_file *req_file);
|
|
|
|
#endif
|