diff options
author | Aki <please@ignore.pl> | 2020-05-02 14:48:14 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2020-05-02 14:48:14 +0200 |
commit | 890ed2ce61a20e7ae14070fc1a76b24e248d0d08 (patch) | |
tree | 74578e0767b06c7a7641d9ae8205dff00fedb326 /http.c | |
parent | cb558e648250eb886bcadbec7da6dc650ebe7839 (diff) | |
download | plop-890ed2ce61a20e7ae14070fc1a76b24e248d0d08.zip plop-890ed2ce61a20e7ae14070fc1a76b24e248d0d08.tar.gz plop-890ed2ce61a20e7ae14070fc1a76b24e248d0d08.tar.bz2 |
Added initial method parsing
Diffstat (limited to 'http.c')
-rw-r--r-- | http.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -82,6 +82,20 @@ int parse_request(const int fd, struct request * const request) return -1; // TODO: Handle errors properly } + for (int i = 0; i < NUMBER_OF_METHODS; ++i) + { + if (0 == strncmp(method_str[i], buffer, strlen(method_str[i]))) + { + request->method = i; + break; + } + + if (NUMBER_OF_METHODS - 1 == i) + { + // TODO: 501 Not Implemented + } + } + request->body = malloc(length + 1); memcpy(request->body, buffer, length); request->body[length] = 0; |