This commit is contained in:
@@ -3,6 +3,7 @@ cmake_minimum_required (VERSION 3.0)
|
||||
project (librestd)
|
||||
|
||||
add_definitions (-g -DBUILD_DEBUG)
|
||||
add_definitions("-fprofile-arcs -ftest-coverage")
|
||||
|
||||
include_directories (${CMAKE_SOURCE_DIR}/../libevent/include)
|
||||
include_directories (${CMAKE_BINARY_DIR}/libevent/include)
|
||||
|
||||
@@ -681,16 +681,19 @@ 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));
|
||||
if (strcmp(http->request.httpver, HTTP_PROTOCOL_09) && strcmp(http->request.httpver, HTTP_PROTOCOL_10) && strcmp(http->request.httpver, HTTP_PROTOCOL_11))
|
||||
|
||||
@@ -240,8 +240,12 @@ int restd_rest_handler(short event, restd_conn_t *conn)
|
||||
conn->id = atoi(buffer);
|
||||
return hook->cb(event, conn, hook->userdata);
|
||||
}
|
||||
else if (strcmp(hook->path, http->request.path) == 0)
|
||||
else
|
||||
{
|
||||
int rett = strcmp(hook->path, http->request.path);
|
||||
if (rett == 0)
|
||||
return hook->cb(event, conn, hook->userdata);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -270,7 +274,9 @@ int restd_rest_handler(short event, restd_conn_t *conn)
|
||||
}
|
||||
}
|
||||
|
||||
return conn->server->error_handler(reason, conn, NULL);
|
||||
if (conn->server->error_handler != NULL)
|
||||
return conn->server->error_handler(reason, conn, NULL);
|
||||
return RESTD_CLOSE;
|
||||
}
|
||||
|
||||
BUG_EXIT();
|
||||
|
||||
Reference in New Issue
Block a user