restd: delete and put are functional
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2020-01-22 23:35:59 +01:00
parent 09d7cce817
commit 4694f4e3f0
3 changed files with 62 additions and 59 deletions

View File

@@ -681,18 +681,15 @@ static int parse_requestline(restd_http_t *http, char *line)
char *uri = strtok_r(NULL, " ", &saveptr);
char *httpver = strtok_r(NULL, " ", &saveptr);
char *tmp = strtok_r(NULL, " ", &saveptr);
printf("=============parse_requestline\n");
if (method == NULL || uri == NULL || httpver == NULL || tmp != NULL)
{
DEBUG("Invalid request line. %s", line);
printf("=============pInvalid request line. %s\n", line);
return RESTD_HTTP_ERROR;
}
// Set request method
http->request.method = qstrupper(strdup(method));
printf("============= SAVE METHOD HTTP: %s\n", http->request.method);
// Set HTTP version
http->request.httpver = qstrupper(strdup(httpver));

View File

@@ -213,14 +213,14 @@ int restd_rest_handler(short event, restd_conn_t *conn)
restd_hook_t *hook = (restd_hook_t *)obj.data;
if (hook->cb)
{
DEBUG("ZOB call_hooks: method: %s - %s \n", hook->method, conn->method);
DEBUG("call_hooks: path: %s - %s\n", hook->path, http->request.path);
DEBUG("HOOK FOUND !!!!\n");
// printf("==== ZOB call_hooks: method: %s - %s \n", hook->method, conn->method);
// printf("==== call_hooks: path: %s - %s\n", hook->path, http->request.path);
// printf("==== HOOK FOUND !!!!\n");
if ((hook->method == NULL) || (conn->method == NULL) || (strcmp(hook->method, conn->method) != 0))
{
DEBUG("Hook found but method failed.\n");
// printf("==== Hook found but method failed -> next.\n");
reason = RESTD_ERROR_METHOD_NOT_ALLOWED;
break;
continue;
}
if ((hook->path != NULL) && (http->request.path != NULL))