fixed a bug in qse_httpd_addhnd().

exported qse_httpd_entaskerrorwithmvk()
This commit is contained in:
hyung-hwan 2014-10-30 16:29:48 +00:00
parent 75dea7aa43
commit 2c5d85f55f
7 changed files with 25 additions and 23 deletions

View File

@ -1185,6 +1185,16 @@ QSE_EXPORT qse_httpd_task_t* qse_httpd_entaskerror (
qse_htre_t* req qse_htre_t* req
); );
QSE_EXPORT qse_httpd_task_t* qse_httpd_entaskerrorwithmvk (
qse_httpd_t* httpd,
qse_httpd_client_t* client,
qse_httpd_task_t* pred,
int code,
qse_http_method_t method,
const qse_http_version_t* version,
int keepalive
);
QSE_EXPORT qse_httpd_task_t* qse_httpd_entaskcontinue ( QSE_EXPORT qse_httpd_task_t* qse_httpd_entaskcontinue (
qse_httpd_t* httpd, qse_httpd_t* httpd,
qse_httpd_client_t* client, qse_httpd_client_t* client,

View File

@ -1431,7 +1431,7 @@ printf ("task_main_cgi_2 trigger[0].mask=%d trigger[1].mask=%d cmask=%d\n",
return 1; return 1;
oops: oops:
return (qse_httpd_entask_error (httpd, client, task, 500, cgi->method, &cgi->version, cgi->keepalive) == QSE_NULL)? -1: 0; return (qse_httpd_entaskerrorwithmvk (httpd, client, task, 500, cgi->method, &cgi->version, cgi->keepalive) == QSE_NULL)? -1: 0;
} }
static int task_main_cgi ( static int task_main_cgi (
@ -1595,7 +1595,7 @@ oops:
cgi->script_htrd = QSE_NULL; cgi->script_htrd = QSE_NULL;
} }
return (qse_httpd_entask_error ( return (qse_httpd_entaskerrorwithmvk (
httpd, client, task, http_errnum, httpd, client, task, http_errnum,
cgi->method, &cgi->version, cgi->keepalive) == QSE_NULL)? -1: 0; cgi->method, &cgi->version, cgi->keepalive) == QSE_NULL)? -1: 0;
} }

View File

@ -191,7 +191,7 @@ static QSE_INLINE int task_main_getfile (
int http_errnum; int http_errnum;
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_entaskerrorwithmvk (
httpd, client, x, http_errnum, httpd, client, x, http_errnum,
file->method, &file->version, file->keepalive); file->method, &file->version, file->keepalive);
goto no_file_send; goto no_file_send;
@ -203,7 +203,7 @@ static QSE_INLINE int task_main_getfile (
int http_errnum; int http_errnum;
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_entaskerrorwithmvk (
httpd, client, x, http_errnum, httpd, client, x, http_errnum,
file->method, &file->version, file->keepalive); file->method, &file->version, file->keepalive);
goto no_file_send; goto no_file_send;
@ -226,7 +226,7 @@ static QSE_INLINE int task_main_getfile (
if (file->u.get.range.from >= st.size) if (file->u.get.range.from >= st.size)
{ {
x = qse_httpd_entask_error ( x = qse_httpd_entaskerrorwithmvk (
httpd, client, x, 416, file->method, &file->version, file->keepalive); httpd, client, x, 416, file->method, &file->version, file->keepalive);
goto no_file_send; goto no_file_send;
} }
@ -491,7 +491,7 @@ static int task_main_putfile_2 (
/* snatching is over. writing error may have occurred as well. /* snatching is over. writing error may have occurred as well.
* file->u.put.status should hold a proper status code */ * file->u.put.status should hold a proper status code */
if (qse_httpd_entask_error ( if (qse_httpd_entaskerrorwithmvk (
httpd, client, task, file->u.put.status, httpd, client, task, file->u.put.status,
file->method, &file->version, file->keepalive) == QSE_NULL) return -1; file->method, &file->version, file->keepalive) == QSE_NULL) return -1;
return 0; /* no more data to read. task over */ return 0; /* no more data to read. task over */
@ -516,7 +516,7 @@ static int task_main_putfile (
* note: if initialization error occurred and there is contents for the * note: if initialization error occurred and there is contents for the
* client to send, this reply may get to the client before it finishes * client to send, this reply may get to the client before it finishes
* sending the contents. */ * sending the contents. */
if (qse_httpd_entask_error ( if (qse_httpd_entaskerrorwithmvk (
httpd, client, task, file->u.put.status, httpd, client, task, file->u.put.status,
file->method, &file->version, file->keepalive) == QSE_NULL) return -1; file->method, &file->version, file->keepalive) == QSE_NULL) return -1;
return 0; /* task over */ return 0; /* task over */

View File

@ -1854,7 +1854,7 @@ qse_printf (QSE_T("TRAILING DATA=%d, [%hs]\n"), (int)QSE_MBS_LEN(proxy->res), QS
oops: oops:
if (proxy->resflags & PROXY_RES_EVER_SENTBACK) return -1; if (proxy->resflags & PROXY_RES_EVER_SENTBACK) return -1;
return (qse_httpd_entask_error (httpd, client, task, http_errnum, proxy->method, &proxy->version, proxy->keepalive) == QSE_NULL)? -1: 0; return (qse_httpd_entaskerrorwithmvk (httpd, client, task, http_errnum, proxy->method, &proxy->version, proxy->keepalive) == QSE_NULL)? -1: 0;
} }
static int task_main_proxy_1 ( static int task_main_proxy_1 (
@ -1947,7 +1947,7 @@ static int task_main_proxy_1 (
return 1; return 1;
oops: oops:
return (qse_httpd_entask_error (httpd, client, task, http_errnum, proxy->method, &proxy->version, proxy->keepalive) == QSE_NULL)? -1: 0; return (qse_httpd_entaskerrorwithmvk (httpd, client, task, http_errnum, proxy->method, &proxy->version, proxy->keepalive) == QSE_NULL)? -1: 0;
} }
static void on_peer_name_resolved (qse_httpd_t* httpd, const qse_mchar_t* name, const qse_nwad_t* nwad, void* ctx) static void on_peer_name_resolved (qse_httpd_t* httpd, const qse_mchar_t* name, const qse_nwad_t* nwad, void* ctx)
@ -2406,7 +2406,7 @@ oops:
proxy->peer_htrd = QSE_NULL; proxy->peer_htrd = QSE_NULL;
} }
return (qse_httpd_entask_error ( return (qse_httpd_entaskerrorwithmvk (
httpd, client, task, http_errnum, httpd, client, task, http_errnum,
proxy->method, &proxy->version, proxy->keepalive) == QSE_NULL)? -1: 0; proxy->method, &proxy->version, proxy->keepalive) == QSE_NULL)? -1: 0;
} }

View File

@ -228,10 +228,12 @@ qse_httpd_task_t* qse_httpd_entask_status (
} }
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
qse_httpd_task_t* qse_httpd_entask_error ( qse_httpd_task_t* qse_httpd_entaskerrorwithmvk (
qse_httpd_t* httpd, qse_httpd_client_t* client, qse_httpd_t* httpd, qse_httpd_client_t* client,
qse_httpd_task_t* pred, int code, qse_httpd_task_t* pred, int code,
qse_http_method_t method, const qse_http_version_t* version, int keepalive) qse_http_method_t method,
const qse_http_version_t* version,
int keepalive)
{ {
return qse_httpd_entask_status (httpd, client, pred, code, QSE_NULL, method, version, keepalive); return qse_httpd_entask_status (httpd, client, pred, code, QSE_NULL, method, version, keepalive);
} }

View File

@ -906,7 +906,7 @@ int qse_httpd_addhnd (qse_httpd_t* httpd, qse_httpd_hnd_t handle, int mask, qse_
/* qse_httpd_loop() opens the multiplexer. you can call this function from /* qse_httpd_loop() opens the multiplexer. you can call this function from
* preloop/postloop hooks only. but calling it from postloop hooks is * preloop/postloop hooks only. but calling it from postloop hooks is
* useless. */ * useless. */
return httpd->opt.scb.mux.addhnd (httpd, httpd->mux, handle, QSE_HTTPD_MUX_READ, mate); return httpd->opt.scb.mux.addhnd (httpd, httpd->mux, handle, mask, mate);
} }
int qse_httpd_delhnd (qse_httpd_t* httpd, qse_httpd_hnd_t handle) int qse_httpd_delhnd (qse_httpd_t* httpd, qse_httpd_hnd_t handle)

View File

@ -132,16 +132,6 @@ qse_httpd_task_t* qse_httpd_entask_status (
int keepalive int keepalive
); );
qse_httpd_task_t* qse_httpd_entask_error (
qse_httpd_t* httpd,
qse_httpd_client_t* client,
qse_httpd_task_t* pred,
int code,
qse_http_method_t method,
const qse_http_version_t* version,
int keepalive
);
qse_httpd_task_t* qse_httpd_entask_nomod ( qse_httpd_task_t* qse_httpd_entask_nomod (
qse_httpd_t* httpd, qse_httpd_t* httpd,
qse_httpd_client_t* client, qse_httpd_client_t* client,