mirror of
https://github.com/lxsang/ant-http
synced 2024-12-26 00:38:21 +01:00
Update http_server.c
This commit is contained in:
parent
99c5df1c48
commit
e6f0588a84
@ -423,19 +423,20 @@ void *resolve_request(void *data)
|
|||||||
antd_request_t *rq = (antd_request_t *)data;
|
antd_request_t *rq = (antd_request_t *)data;
|
||||||
antd_task_t *task = antd_create_task(NULL, (void *)rq, NULL, rq->client->last_io);
|
antd_task_t *task = antd_create_task(NULL, (void *)rq, NULL, rq->client->last_io);
|
||||||
char *url = (char *)dvalue(rq->request, "RESOURCE_PATH");
|
char *url = (char *)dvalue(rq->request, "RESOURCE_PATH");
|
||||||
char *newurl = NULL;
|
//char *newurl = NULL;
|
||||||
char *rqp = NULL;
|
//char *rqp = NULL;
|
||||||
char *oldrqp = NULL;
|
//char *oldrqp = NULL;
|
||||||
rq->client->state = ANTD_CLIENT_RESOLVE_REQUEST;
|
rq->client->state = ANTD_CLIENT_RESOLVE_REQUEST;
|
||||||
htdocs(rq, path);
|
htdocs(rq, path);
|
||||||
strcat(path, url);
|
strcat(path, url);
|
||||||
//LOG("Path is : %s", path);
|
LOG("URL is : %s", url);
|
||||||
|
LOG("Resource Path is : %s", path);
|
||||||
//if (path[strlen(path) - 1] == '/')
|
//if (path[strlen(path) - 1] == '/')
|
||||||
// strcat(path, "index.html");
|
// strcat(path, "index.html");
|
||||||
if (stat(path, &st) == -1)
|
if (stat(path, &st) == -1)
|
||||||
{
|
{
|
||||||
free(task);
|
free(task);
|
||||||
rqp = strdup((char *)dvalue(rq->request, "REQUEST_PATH"));
|
rqp = strdup(url);
|
||||||
oldrqp = rqp;
|
oldrqp = rqp;
|
||||||
trim(rqp, '/');
|
trim(rqp, '/');
|
||||||
newurl = strsep(&rqp, "/");
|
newurl = strsep(&rqp, "/");
|
||||||
@ -444,6 +445,7 @@ void *resolve_request(void *data)
|
|||||||
else
|
else
|
||||||
rqp = strdup(rqp);
|
rqp = strdup(rqp);
|
||||||
dput(rq->request, "RESOURCE_PATH", rqp);
|
dput(rq->request, "RESOURCE_PATH", rqp);
|
||||||
|
LOG("Execute plugin %s", newurl);
|
||||||
task = execute_plugin(rq, newurl);
|
task = execute_plugin(rq, newurl);
|
||||||
free(oldrqp);
|
free(oldrqp);
|
||||||
return task;
|
return task;
|
||||||
|
Loading…
Reference in New Issue
Block a user