added qse_httpd_getserveroptstd() and qse_httpd_setserveroptstd().
added an output length parameter to qse_mbstowcsdup() and similar functions
This commit is contained in:
@ -167,7 +167,7 @@ static int test3 (void)
|
||||
{
|
||||
qse_wchar_t* wcs;
|
||||
|
||||
wcs = qse_mbstowcsdup (x[i], QSE_MMGR_GETDFL());
|
||||
wcs = qse_mbstowcsdup (x[i], QSE_NULL, QSE_MMGR_GETDFL());
|
||||
if (wcs == QSE_NULL)
|
||||
{
|
||||
qse_printf (QSE_T("[ERROR]"));
|
||||
@ -198,7 +198,7 @@ static int test4 (void)
|
||||
};
|
||||
qse_wchar_t* wcs;
|
||||
|
||||
wcs = qse_mbsatowcsdup (x, QSE_MMGR_GETDFL());
|
||||
wcs = qse_mbsatowcsdup (x, QSE_NULL, QSE_MMGR_GETDFL());
|
||||
if (wcs == QSE_NULL)
|
||||
{
|
||||
qse_printf (QSE_T("[ERROR]\n"));
|
||||
|
@ -235,7 +235,7 @@ static int test3 (void)
|
||||
|
||||
for (i = 0; i < QSE_COUNTOF(x); i++)
|
||||
{
|
||||
qse_mchar_t* m = qse_wcstombsdup (x[i], QSE_MMGR_GETDFL());
|
||||
qse_mchar_t* m = qse_wcstombsdup (x[i], QSE_NULL, QSE_MMGR_GETDFL());
|
||||
if (m == QSE_NULL)
|
||||
{
|
||||
qse_printf (QSE_T("[ERROR]\n"), m);
|
||||
@ -277,7 +277,7 @@ static int test4 (void)
|
||||
|
||||
x[1] = unistr;
|
||||
|
||||
m = qse_wcsatombsdup (x, QSE_MMGR_GETDFL());
|
||||
m = qse_wcsatombsdup (x, QSE_NULL, QSE_MMGR_GETDFL());
|
||||
if (m == QSE_NULL)
|
||||
{
|
||||
qse_printf (QSE_T("[ERROR]\n"), m);
|
||||
|
@ -59,7 +59,6 @@ static int httpd_main (int argc, qse_char_t* argv[])
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
qse_httpd_server_t* server;
|
||||
qse_httpd_server_xtn_t* server_xtn;
|
||||
|
||||
server = qse_httpd_attachserverstd (httpd, argv[i], QSE_NULL, 0);
|
||||
if (server == QSE_NULL)
|
||||
@ -69,13 +68,10 @@ static int httpd_main (int argc, qse_char_t* argv[])
|
||||
goto oops;
|
||||
}
|
||||
|
||||
server_xtn = qse_httpd_getserverxtn (httpd, server);
|
||||
/* don't care about failure */
|
||||
server_xtn->cfg[QSE_HTTPD_SERVER_XTN_CFG_DIRCSS] =
|
||||
qse_mbsdup (QSE_MT("<style type='text/css'>body { background-color:#d0e4fe; font-size: 0.9em; } div.header { font-weight: bold; margin-bottom: 5px; } div.footer { border-top: 1px solid #99AABB; text-align: right; } table { font-size: 0.9em; } td { white-space: nowrap; } td.size { text-align: right; }</style>"), qse_httpd_getmmgr(httpd));
|
||||
|
||||
server_xtn->cfg[QSE_HTTPD_SERVER_XTN_CFG_ERRORCSS] =
|
||||
qse_mbsdup (QSE_MT("<style type='text/css'>body { background-color:#d0e4fe; font-size: 0.9em; } div.header { font-weight: bold; margin-bottom: 5px; } div.footer { border-top: 1px solid #99AABB; text-align: right; }</style>"), qse_httpd_getmmgr(httpd));
|
||||
qse_httpd_setserveroptstd (httpd, server, QSE_HTTPD_SERVER_DIRCSS,
|
||||
QSE_MT("<style type='text/css'>body { background-color:#d0e4fe; font-size: 0.9em; } div.header { font-weight: bold; margin-bottom: 5px; } div.footer { border-top: 1px solid #99AABB; text-align: right; } table { font-size: 0.9em; } td { white-space: nowrap; } td.size { text-align: right; }</style>"));
|
||||
qse_httpd_setserveroptstd (httpd, server, QSE_HTTPD_SERVER_ERRCSS,
|
||||
QSE_MT("<style type='text/css'>body { background-color:#d0e4fe; font-size: 0.9em; } div.header { font-weight: bold; margin-bottom: 5px; } div.footer { border-top: 1px solid #99AABB; text-align: right; }</style>"));
|
||||
}
|
||||
|
||||
g_httpd = httpd;
|
||||
|
@ -52,7 +52,8 @@ struct server_xtn_t
|
||||
};
|
||||
|
||||
static int makersrc (
|
||||
qse_httpd_t* httpd, qse_httpd_client_t* client, qse_htre_t* req, qse_httpd_rsrc_t* rsrc)
|
||||
qse_httpd_t* httpd, qse_httpd_client_t* client,
|
||||
qse_htre_t* req, qse_httpd_rsrc_t* rsrc)
|
||||
{
|
||||
server_xtn_t* server_xtn;
|
||||
|
||||
@ -65,8 +66,8 @@ static int makersrc (
|
||||
/* TODO: implement a better check that the
|
||||
* destination is not one of the local addresses */
|
||||
|
||||
rsrc->type = QSE_HTTPD_RSRC_ERROR;
|
||||
rsrc->u.error.code = 500;
|
||||
rsrc->type = QSE_HTTPD_RSRC_ERR;
|
||||
rsrc->u.err.code = 500;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -100,7 +101,9 @@ static int makersrc (
|
||||
}
|
||||
}
|
||||
|
||||
static void freersrc (qse_httpd_t* httpd, qse_httpd_client_t* client, qse_htre_t* req, qse_httpd_rsrc_t* rsrc)
|
||||
static void freersrc (
|
||||
qse_httpd_t* httpd, qse_httpd_client_t* client,
|
||||
qse_htre_t* req, qse_httpd_rsrc_t* rsrc)
|
||||
{
|
||||
server_xtn_t* server_xtn;
|
||||
|
||||
@ -123,7 +126,6 @@ static qse_httpd_server_t* attach_server (
|
||||
qse_httpd_t* httpd, qse_char_t* uri, qse_httpd_server_cbstd_t* cbstd)
|
||||
{
|
||||
qse_httpd_server_t* server;
|
||||
qse_httpd_server_xtn_t* server_xtn_inner;
|
||||
server_xtn_t* server_xtn;
|
||||
int tproxy = 0;
|
||||
|
||||
@ -154,18 +156,27 @@ static qse_httpd_server_t* attach_server (
|
||||
* extension space created by qse_httpd_attachserverstd()
|
||||
* internally.
|
||||
*/
|
||||
server_xtn_inner = qse_httpd_getserverxtn (httpd, server);
|
||||
/* remember the callback set in qse_httpd_attachserverstd() */
|
||||
server_xtn->orgcbstd = server_xtn_inner->cbstd;
|
||||
qse_httpd_getserveroptstd (
|
||||
httpd, server,
|
||||
QSE_HTTPD_SERVER_CBSTD, (void**)&server_xtn->orgcbstd);
|
||||
/* override it with a new callback for chaining */
|
||||
server_xtn_inner->cbstd = cbstd;
|
||||
server_xtn_inner->idxstd = idxstd; /* override index file list */
|
||||
qse_httpd_setserveroptstd (
|
||||
httpd, server,
|
||||
QSE_HTTPD_SERVER_CBSTD, cbstd);
|
||||
|
||||
/* don't care about failure */
|
||||
server_xtn_inner->cfg[QSE_HTTPD_SERVER_XTN_CFG_DIRCSS] =
|
||||
qse_mbsdup (QSE_MT("<style type='text/css'>body { background-color:#d0e4fe; font-size: 0.9em; } div.header { font-weight: bold; margin-bottom: 5px; } div.footer { border-top: 1px solid #99AABB; text-align: right; } table { font-size: 0.9em; } td { white-space: nowrap; } td.size { text-align: right; }</style>"), qse_httpd_getmmgr(httpd));
|
||||
server_xtn_inner->cfg[QSE_HTTPD_SERVER_XTN_CFG_ERRORCSS] =
|
||||
qse_mbsdup (QSE_MT("<style type='text/css'>body { background-color:#d0e4fe; font-size: 0.9em; } div.header { font-weight: bold; margin-bottom: 5px; } div.footer { border-top: 1px solid #99AABB; text-align: right; }</style>"), qse_httpd_getmmgr(httpd));
|
||||
/* totally override idxstd without remembering the old idxstd */
|
||||
qse_httpd_setserveroptstd (
|
||||
httpd, server,
|
||||
QSE_HTTPD_SERVER_IDXSTD, idxstd);
|
||||
|
||||
qse_httpd_setserveroptstd (
|
||||
httpd, server, QSE_HTTPD_SERVER_DIRCSS,
|
||||
QSE_MT("<style type='text/css'>body { background-color:#d0e4fe; font-size: 0.9em; } div.header { font-weight: bold; margin-bottom: 5px; } div.footer { border-top: 1px solid #99AABB; text-align: right; } table { font-size: 0.9em; } td { white-space: nowrap; } td.size { text-align: right; }</style>"));
|
||||
|
||||
qse_httpd_setserveroptstd (
|
||||
httpd, server, QSE_HTTPD_SERVER_ERRCSS,
|
||||
QSE_MT("<style type='text/css'>body { background-color:#d0e4fe; font-size: 0.9em; } div.header { font-weight: bold; margin-bottom: 5px; } div.footer { border-top: 1px solid #99AABB; text-align: right; }</style>"));
|
||||
|
||||
return server;
|
||||
}
|
||||
|
Reference in New Issue
Block a user