moved the directory end check and redirection from httpd-dir.c to httpd-std.c
This commit is contained in:
parent
e02ee7b452
commit
4d8c02588f
@ -399,8 +399,14 @@ static QSE_INLINE int task_main_dir (
|
|||||||
dir = (task_dir_t*)task->ctx;
|
dir = (task_dir_t*)task->ctx;
|
||||||
x = task;
|
x = task;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* I've commented out the check for a slash at the end of the query path
|
||||||
|
* expecting that redirection is performed by the caller if such a condition
|
||||||
|
* isn't met or that redirection is not required under such a condition.
|
||||||
|
|
||||||
if (qse_mbsend (dir->qpath.ptr, QSE_MT("/")))
|
if (qse_mbsend (dir->qpath.ptr, QSE_MT("/")))
|
||||||
{
|
{
|
||||||
|
*/
|
||||||
if (httpd->opt.scb.dir.open (httpd, dir->path.ptr, &handle) <= -1)
|
if (httpd->opt.scb.dir.open (httpd, dir->path.ptr, &handle) <= -1)
|
||||||
{
|
{
|
||||||
int http_errnum;
|
int http_errnum;
|
||||||
@ -429,6 +435,7 @@ static QSE_INLINE int task_main_dir (
|
|||||||
httpd->opt.scb.dir.close (httpd, handle);
|
httpd->opt.scb.dir.close (httpd, handle);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -438,6 +445,7 @@ static QSE_INLINE int task_main_dir (
|
|||||||
|
|
||||||
return (x == QSE_NULL)? -1: 0;
|
return (x == QSE_NULL)? -1: 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
qse_httpd_task_t* qse_httpd_entaskdir (
|
qse_httpd_task_t* qse_httpd_entaskdir (
|
||||||
|
@ -2200,6 +2200,11 @@ static void free_resource (
|
|||||||
QSE_MMGR_FREE (httpd->mmgr, (qse_mchar_t*)target->u.reloc.dst);
|
QSE_MMGR_FREE (httpd->mmgr, (qse_mchar_t*)target->u.reloc.dst);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case QSE_HTTPD_RSRC_REDIR:
|
||||||
|
if (target->u.redir.dst != qpath)
|
||||||
|
QSE_MMGR_FREE (httpd->mmgr, (qse_mchar_t*)target->u.redir.dst);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
break;
|
break;
|
||||||
@ -2561,6 +2566,14 @@ auth_ok:
|
|||||||
/* free xpath since it won't be used */
|
/* free xpath since it won't be used */
|
||||||
QSE_MMGR_FREE (httpd->mmgr, tmp.xpath);
|
QSE_MMGR_FREE (httpd->mmgr, tmp.xpath);
|
||||||
}
|
}
|
||||||
|
else if (tmp.qpath[tmp.qpath_len - 1] != QSE_MT('/'))
|
||||||
|
{
|
||||||
|
/* the query path doesn't end with a slash. so redirect it */
|
||||||
|
target->type = QSE_HTTPD_RSRC_REDIR;
|
||||||
|
target->u.redir.dst = tmp.qpath;
|
||||||
|
/* free xpath since it won't be used */
|
||||||
|
QSE_MMGR_FREE (httpd->mmgr, tmp.xpath);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
target->type = QSE_HTTPD_RSRC_DIR;
|
target->type = QSE_HTTPD_RSRC_DIR;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user