changed debugging ouput tput format
This commit is contained in:
parent
f10f9a569b
commit
e35190e23d
@ -936,7 +936,7 @@ static int server_open (qse_httpd_t* httpd, qse_httpd_server_t* server)
|
||||
{
|
||||
/* TODO: logging. warning only */
|
||||
/* this is not a hard failure */
|
||||
qse_fprintf (QSE_STDERR, QSE_T("Failed to enable SO_REUSEPORT\n"));
|
||||
HTTPD_DBGOUT1 ("Failed to enable SO_REUSERPORT on %zd\n", (qse_size_t)fd);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -541,7 +541,7 @@ static void free_client (
|
||||
#if defined(QSE_HTTPD_DEBUG)
|
||||
{
|
||||
qse_mchar_t tmp[128];
|
||||
qse_nwadtombs (&client->remote_addr, tmp, QSE_COUNTOF(tmp), QSE_NWADTOSTR_ALL);
|
||||
qse_nwadtombs (&client->remote_addr, tmp, QSE_COUNTOF(tmp), QSE_NWADTOMBS_ALL);
|
||||
HTTPD_DBGOUT2 ("Closing client [%hs] - %zd\n", tmp, (qse_size_t)client->handle);
|
||||
}
|
||||
#endif
|
||||
@ -579,7 +579,7 @@ static void purge_client (qse_httpd_t* httpd, qse_httpd_client_t* client)
|
||||
#if defined(QSE_HTTPD_DEBUG)
|
||||
{
|
||||
qse_mchar_t tmp[128];
|
||||
qse_nwadtombs (&client->remote_addr, tmp, QSE_COUNTOF(tmp), QSE_NWADTOSTR_ALL);
|
||||
qse_nwadtombs (&client->remote_addr, tmp, QSE_COUNTOF(tmp), QSE_NWADTOMBS_ALL);
|
||||
HTTPD_DBGOUT2 ("Purged client [%hs] - %zd\n", tmp, (qse_size_t)client->handle);
|
||||
}
|
||||
#endif
|
||||
@ -656,7 +656,7 @@ static int accept_client (
|
||||
{
|
||||
#if QSE_HTTPD_DEBUG
|
||||
qse_mchar_t tmp[128];
|
||||
qse_nwadtombs (&server->dope.nwad, tmp, QSE_COUNTOF(tmp), QSE_NWADTOSTR_ALL);
|
||||
qse_nwadtombs (&server->dope.nwad, tmp, QSE_COUNTOF(tmp), QSE_NWADTOMBS_ALL);
|
||||
HTTPD_DBGOUT2 ("Failed to accept from server [%hs] [%d]\n", tmp, (int)server->handle);
|
||||
#endif
|
||||
return -1;
|
||||
@ -708,9 +708,9 @@ static int accept_client (
|
||||
#if defined(QSE_HTTPD_DEBUG)
|
||||
{
|
||||
qse_mchar_t tmp1[128], tmp2[128], tmp3[128];
|
||||
qse_nwadtombs (&client->local_addr, tmp1, QSE_COUNTOF(tmp1), QSE_NWADTOSTR_ALL);
|
||||
qse_nwadtombs (&client->orgdst_addr, tmp2, QSE_COUNTOF(tmp2), QSE_NWADTOSTR_ALL);
|
||||
qse_nwadtombs (&client->remote_addr, tmp3, QSE_COUNTOF(tmp3), QSE_NWADTOSTR_ALL);
|
||||
qse_nwadtombs (&client->local_addr, tmp1, QSE_COUNTOF(tmp1), QSE_NWADTOMBS_ALL);
|
||||
qse_nwadtombs (&client->orgdst_addr, tmp2, QSE_COUNTOF(tmp2), QSE_NWADTOMBS_ALL);
|
||||
qse_nwadtombs (&client->remote_addr, tmp3, QSE_COUNTOF(tmp3), QSE_NWADTOMBS_ALL);
|
||||
HTTPD_DBGOUT3 ("Accepted client %hs(%hs) from %hs\n", tmp1, tmp2, tmp3);
|
||||
}
|
||||
#endif
|
||||
@ -774,6 +774,14 @@ static void deactivate_servers (qse_httpd_t* httpd)
|
||||
{
|
||||
if (server->dope.flags & QSE_HTTPD_SERVER_ACTIVE)
|
||||
{
|
||||
#if defined(QSE_HTTPD_DEBUG)
|
||||
{
|
||||
qse_mchar_t tmp[128];
|
||||
qse_nwadtombs (&server->dope.nwad, tmp, QSE_COUNTOF(tmp), QSE_NWADTOMBS_ALL);
|
||||
HTTPD_DBGOUT2 ("Closing server [%hs] %zd to mux\n", tmp, (qse_size_t)server->handle);
|
||||
}
|
||||
#endif
|
||||
|
||||
httpd->opt.scb.mux.delhnd (httpd, httpd->mux, server->handle);
|
||||
httpd->opt.scb.server.close (httpd, server);
|
||||
server->dope.flags &= ~QSE_HTTPD_SERVER_ACTIVE;
|
||||
@ -792,29 +800,37 @@ static int activate_servers (qse_httpd_t* httpd)
|
||||
|
||||
if (httpd->opt.scb.server.open (httpd, server) <= -1)
|
||||
{
|
||||
qse_char_t buf[64];
|
||||
qse_nwadtostr (&server->dope.nwad, buf, QSE_COUNTOF(buf), QSE_NWADTOSTR_ALL);
|
||||
#if defined(QSE_HTTPD_DEBUG)
|
||||
{
|
||||
qse_mchar_t tmp[128];
|
||||
qse_nwadtombs (&server->dope.nwad, tmp, QSE_COUNTOF(tmp), QSE_NWADTOMBS_ALL);
|
||||
HTTPD_DBGOUT1 ("Cannot open server [%hs]\n", tmp);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
httpd->opt.rcb.log (httpd, 0, QSE_T("cannot activate %s"), buf);
|
||||
*/
|
||||
#if 1
|
||||
qse_printf(QSE_T("cannot activate [%s]\n"), buf);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(QSE_HTTPD_DEBUG)
|
||||
{
|
||||
qse_mchar_t tmp[128];
|
||||
qse_nwadtombs (&server->dope.nwad, tmp, QSE_COUNTOF(tmp), QSE_NWADTOMBS_ALL);
|
||||
HTTPD_DBGOUT2 ("Opened server [%hs] - %zd\n", tmp, (qse_size_t)server->handle);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (httpd->opt.scb.mux.addhnd (
|
||||
httpd, httpd->mux, server->handle, QSE_HTTPD_MUX_READ, server) <= -1)
|
||||
{
|
||||
qse_char_t buf[64];
|
||||
qse_nwadtostr (&server->dope.nwad, buf, QSE_COUNTOF(buf), QSE_NWADTOSTR_ALL);
|
||||
/*
|
||||
httpd->opt.rcb.log (httpd, 0, QSE_T("cannot activate %s - "), buf);
|
||||
*/
|
||||
#if 1
|
||||
qse_printf(QSE_T("cannot add handle [%s]\n"), buf);
|
||||
#endif
|
||||
#if defined(QSE_HTTPD_DEBUG)
|
||||
{
|
||||
qse_mchar_t tmp[128];
|
||||
qse_nwadtombs (&server->dope.nwad, tmp, QSE_COUNTOF(tmp), QSE_NWADTOMBS_ALL);
|
||||
HTTPD_DBGOUT2 ("Cannot add server [%hs] %zd to mux. Closing\n", tmp, (qse_size_t)server->handle);
|
||||
}
|
||||
#endif
|
||||
|
||||
httpd->opt.scb.server.close (httpd, server);
|
||||
continue;
|
||||
|
@ -24,21 +24,20 @@
|
||||
/* private header file for httpd */
|
||||
|
||||
#include <qse/http/httpd.h>
|
||||
#include <qse/cmn/sio.h>
|
||||
|
||||
#define QSE_HTTPD_DEFAULT_PORT 80
|
||||
#define QSE_HTTPD_DEFAULT_SECURE_PORT 443
|
||||
|
||||
#define QSE_HTTPD_DEBUG 1
|
||||
/*#undef QSE_HTTPD_DEBUG*/
|
||||
|
||||
|
||||
#if defined(QSE_HTTPD_DEBUG)
|
||||
# define HTTPD_DBGOUT0(fmt) qse_putmbsf("%hs:%d: " fmt, __FILE__, (int)__LINE__)
|
||||
# define HTTPD_DBGOUT1(fmt,a1) qse_putmbsf("%hs:%d: " fmt, __FILE__, (int)__LINE__, (a1))
|
||||
# define HTTPD_DBGOUT2(fmt,a1,a2) qse_putmbsf("%hs:%d: " fmt, __FILE__, (int)__LINE__, (a1), (a2))
|
||||
# define HTTPD_DBGOUT3(fmt,a1,a2,a3) qse_putmbsf("%hs:%d: " fmt, __FILE__, (int)__LINE__, (a1), (a2), (a3))
|
||||
# define HTTPD_DBGOUT4(fmt,a1,a2,a3,a4) qse_putmbsf("%hs:%d: " fmt, __FILE__, (int)__LINE__, (a1), (a2), (a3), (a4))
|
||||
# define HTTPD_DBGOUT5(fmt,a1,a2,a3,a4,a5) qse_putmbsf("%hs:%d: " fmt, __FILE__, (int)__LINE__, (a1), (a2), (a3), (a4), (a5))
|
||||
# include <qse/cmn/sio.h>
|
||||
# include <qse/cmn/path.h>
|
||||
# define HTTPD_DBGOUT0(fmt) qse_putmbsf("%06d %-20hs " fmt, (int)__LINE__, qse_mbsbasename(__FILE__))
|
||||
# define HTTPD_DBGOUT1(fmt,a1) qse_putmbsf("%06d %-20hs " fmt, (int)__LINE__, qse_mbsbasename(__FILE__), (a1))
|
||||
# define HTTPD_DBGOUT2(fmt,a1,a2) qse_putmbsf("%06d %-20hs " fmt, (int)__LINE__, qse_mbsbasename(__FILE__), (a1), (a2))
|
||||
# define HTTPD_DBGOUT3(fmt,a1,a2,a3) qse_putmbsf("%06d %-20hs " fmt, (int)__LINE__, qse_mbsbasename(__FILE__), (a1), (a2), (a3))
|
||||
# define HTTPD_DBGOUT4(fmt,a1,a2,a3,a4) qse_putmbsf("%06d %-20hs " fmt, (int)__LINE__, qse_mbsbasename(__FILE__), (a1), (a2), (a3), (a4))
|
||||
# define HTTPD_DBGOUT5(fmt,a1,a2,a3,a4,a5) qse_putmbsf("%06d %-20hs " fmt, (int)__LINE__, qse_mbsbasename(__FILE__), (a1), (a2), (a3), (a4), (a5))
|
||||
#else
|
||||
# define HTTPD_DBGOUT0(fmt)
|
||||
# define HTTPD_DBGOUT1(fmt,a1)
|
||||
@ -48,6 +47,11 @@
|
||||
# define HTTPD_DBGOUT5(fmt,a1,a2,a3,a4,a5)
|
||||
#endif
|
||||
|
||||
|
||||
#define QSE_HTTPD_DEFAULT_PORT 80
|
||||
#define QSE_HTTPD_DEFAULT_SECURE_PORT 443
|
||||
|
||||
|
||||
struct qse_httpd_t
|
||||
{
|
||||
qse_mmgr_t* mmgr;
|
||||
|
Loading…
Reference in New Issue
Block a user