added qse_httpd_serverstd_realm_t and qse_httpd_serverstd_auth_t

This commit is contained in:
2013-02-22 08:56:34 +00:00
parent f3d6d8a0e1
commit 9e2010f85c
7 changed files with 73 additions and 11 deletions

View File

@ -20,3 +20,5 @@ if WCHAR
qsehttpd_LDADD += $(UNICOWS_LIBS)
endif
endif
EXTRA_DIST = $(qsecfg_DATA)

View File

@ -309,6 +309,7 @@ qsecfg_DATA = httpd.conf httpd-mime.conf
qsehttpd_SOURCES = httpd.c
qsehttpd_LDFLAGS = -L../../lib/xli -L../../lib/http -L../../lib/cmn -L$(libdir)
qsehttpd_LDADD = -lqsexli -lqsehttp -lqsecmn $(am__append_1)
EXTRA_DIST = $(qsecfg_DATA)
all: all-am
.SUFFIXES:

View File

@ -447,12 +447,26 @@ static int query_server (
return 0;
case QSE_HTTPD_SERVERSTD_REALM:
*(const qse_mchar_t**)result = server_xtn->scfg[SCFG_REALM];
((qse_httpd_serverstd_realm_t*)result)->name = server_xtn->scfg[SCFG_REALM];
((qse_httpd_serverstd_realm_t*)result)->authreq = (server_xtn->scfg[SCFG_REALM] != QSE_NULL);
return 0;
case QSE_HTTPD_SERVERSTD_AUTH:
*(const qse_mchar_t**)result = server_xtn->scfg[SCFG_AUTH];
{
qse_httpd_serverstd_auth_t* auth;
auth = (qse_httpd_serverstd_auth_t*)result;
auth->authok = 0;
if (server_xtn->scfg[SCFG_AUTH])
{
if (qse_mbsxcmp (auth->key.ptr, auth->key.len, server_xtn->scfg[SCFG_AUTH]) == 0)
{
auth->authok = 1;
}
}
return 0;
}
case QSE_HTTPD_SERVERSTD_DIRCSS:
*(const qse_mchar_t**)result = server_xtn->scfg[SCFG_DIRCSS];
@ -829,10 +843,13 @@ static int load_server_config (
}
/* perform more sanity check */
/* TODO: support multiple auth entries here and above */
#if 0
if (qse_mbschr (server_xtn->scfg[SCFG_AUTH], QSE_MT(':')) == QSE_NULL)
{
qse_printf (QSE_T("WARNING: no colon in the auth string - [%hs]\n"), server_xtn->scfg[SCFG_AUTH]);
}
#endif
if (qse_mbstonwad (server_xtn->scfg[SCFG_ROOT], &server_xtn->root_nwad) >= 0) server_xtn->root_is_nwad = 1;
return 0;