disabled chunking in directory listing regardless of keep-alive if http version is 1.0 or earlier
This commit is contained in:
parent
d207120933
commit
1f47f89062
@ -515,6 +515,18 @@ static QSE_INLINE int task_main_getdir (
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
int keepalive_ignored = 0;
|
||||||
|
|
||||||
|
if (dir->keepalive && (dir->version.major < 1 || (dir->version.major == 1 && dir->version.minor <= 0)))
|
||||||
|
{
|
||||||
|
/* this task does chunking when keepalive is set.
|
||||||
|
* chunking is not supported for http 1.0 or earlier.
|
||||||
|
* force switch to the close mode */
|
||||||
|
dir->keepalive = 0;
|
||||||
|
keepalive_ignored = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
x = qse_httpd_entaskformat (
|
x = qse_httpd_entaskformat (
|
||||||
httpd, client, x,
|
httpd, client, x,
|
||||||
QSE_MT("HTTP/%d.%d 200 OK\r\nServer: %s\r\nDate: %s\r\nConnection: %s\r\nContent-Type: text/html\r\n%s\r\n"),
|
QSE_MT("HTTP/%d.%d 200 OK\r\nServer: %s\r\nDate: %s\r\nConnection: %s\r\nContent-Type: text/html\r\n%s\r\n"),
|
||||||
@ -543,7 +555,10 @@ static QSE_INLINE int task_main_getdir (
|
|||||||
|
|
||||||
/* arrange to send the actual directory contents */
|
/* arrange to send the actual directory contents */
|
||||||
x = entask_directory_segment (httpd, client, x, dir->handle, dir);
|
x = entask_directory_segment (httpd, client, x, dir->handle, dir);
|
||||||
|
if (keepalive_ignored && x)
|
||||||
|
x = qse_httpd_entaskdisconnect (httpd, client, x);
|
||||||
if (x) return 0;
|
if (x) return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
httpd->opt.scb.dir.close (httpd, dir->handle);
|
httpd->opt.scb.dir.close (httpd, dir->handle);
|
||||||
@ -602,7 +617,7 @@ qse_httpd_task_t* qse_httpd_entaskdir (
|
|||||||
data.foot.ptr = dir->foot? dir->foot: qse_httpd_getname(httpd);
|
data.foot.ptr = dir->foot? dir->foot: qse_httpd_getname(httpd);
|
||||||
data.foot.len = qse_mbslen(data.foot.ptr);
|
data.foot.len = qse_mbslen(data.foot.ptr);
|
||||||
data.version = *qse_htre_getversion(req);
|
data.version = *qse_htre_getversion(req);
|
||||||
data.keepalive = (req->flags & QSE_HTRE_ATTR_KEEPALIVE);
|
data.keepalive = req->flags & QSE_HTRE_ATTR_KEEPALIVE;
|
||||||
data.method = method;
|
data.method = method;
|
||||||
|
|
||||||
QSE_MEMSET (&task, 0, QSE_SIZEOF(task));
|
QSE_MEMSET (&task, 0, QSE_SIZEOF(task));
|
||||||
|
@ -201,7 +201,6 @@ static QSE_INLINE int task_main_getfile (
|
|||||||
if (httpd->opt.scb.file.ropen (httpd, file->path.ptr, &handle) <= -1)
|
if (httpd->opt.scb.file.ropen (httpd, file->path.ptr, &handle) <= -1)
|
||||||
{
|
{
|
||||||
int http_errnum;
|
int http_errnum;
|
||||||
printf ("ropen failure...\n");
|
|
||||||
http_errnum = (httpd->errnum == QSE_HTTPD_ENOENT)? 404:
|
http_errnum = (httpd->errnum == QSE_HTTPD_ENOENT)? 404:
|
||||||
(httpd->errnum == QSE_HTTPD_EACCES)? 403: 500;
|
(httpd->errnum == QSE_HTTPD_EACCES)? 403: 500;
|
||||||
x = qse_httpd_entask_error (
|
x = qse_httpd_entask_error (
|
||||||
@ -211,7 +210,6 @@ printf ("ropen failure...\n");
|
|||||||
}
|
}
|
||||||
fileopen = 1;
|
fileopen = 1;
|
||||||
|
|
||||||
printf ("ropen ok...\n");
|
|
||||||
if (file->u.get.range.type != QSE_HTTP_RANGE_NONE)
|
if (file->u.get.range.type != QSE_HTTP_RANGE_NONE)
|
||||||
{
|
{
|
||||||
qse_mchar_t tmp[4][64];
|
qse_mchar_t tmp[4][64];
|
||||||
|
Loading…
Reference in New Issue
Block a user