mirror of
https://github.com/sigmasternchen/CFloor
synced 2025-03-15 20:28:56 +00:00
added all methods to meta data parser + methodString-function
This commit is contained in:
parent
0e9e7473bd
commit
c5376732ea
2 changed files with 41 additions and 0 deletions
|
@ -186,10 +186,22 @@ int headers_metadata(struct metaData* metaData, char* header) {
|
||||||
|
|
||||||
if (strcmp(_method, "GET") == 0)
|
if (strcmp(_method, "GET") == 0)
|
||||||
method = GET;
|
method = GET;
|
||||||
|
else if (strcmp(_method, "HEAD") == 0)
|
||||||
|
method = HEAD;
|
||||||
else if (strcmp(_method, "POST") == 0)
|
else if (strcmp(_method, "POST") == 0)
|
||||||
method = POST;
|
method = POST;
|
||||||
else if (strcmp(_method, "PUT") == 0)
|
else if (strcmp(_method, "PUT") == 0)
|
||||||
method = PUT;
|
method = PUT;
|
||||||
|
else if (strcmp(_method, "DELETE") == 0)
|
||||||
|
method = DELETE;
|
||||||
|
else if (strcmp(_method, "CONNECT") == 0)
|
||||||
|
method = CONNECT;
|
||||||
|
else if (strcmp(_method, "OPTION") == 0)
|
||||||
|
method = OPTION;
|
||||||
|
else if (strcmp(_method, "TRACE") == 0)
|
||||||
|
method = TRACE;
|
||||||
|
else if (strcmp(_method, "PATCH") == 0)
|
||||||
|
method = PATCH;
|
||||||
else
|
else
|
||||||
return HEADERS_PARSE_ERROR;
|
return HEADERS_PARSE_ERROR;
|
||||||
|
|
||||||
|
@ -220,3 +232,30 @@ int headers_metadata(struct metaData* metaData, char* header) {
|
||||||
|
|
||||||
return HEADERS_SUCCESS;
|
return HEADERS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* methodString(struct metaData metaData) {
|
||||||
|
switch(metaData.method) {
|
||||||
|
case GET:
|
||||||
|
return "GET";
|
||||||
|
case HEAD:
|
||||||
|
return "HEAD";
|
||||||
|
case POST:
|
||||||
|
return "POST";
|
||||||
|
case POST:
|
||||||
|
return "POST";
|
||||||
|
case PUT:
|
||||||
|
return "PUT";
|
||||||
|
case DELETE:
|
||||||
|
return "DELETE";
|
||||||
|
case CONNECT:
|
||||||
|
return "CONNECT";
|
||||||
|
case OPTION:
|
||||||
|
return "OPTION";
|
||||||
|
case TRACE:
|
||||||
|
return "TRACE";
|
||||||
|
case PATCH:
|
||||||
|
return "PATCH";
|
||||||
|
default:
|
||||||
|
return NULL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -29,4 +29,6 @@ void headers_dump(struct headers* headers, FILE* stream);
|
||||||
|
|
||||||
int headers_metadata(struct metaData* metaData, char* header);
|
int headers_metadata(struct metaData* metaData, char* header);
|
||||||
|
|
||||||
|
const char* methodString(struct metaData metaData);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue