added qse_httpd_setname(), qse_httpd_getname(), qse_httpd_fmtgmtimetobb()

added qse_fmthttptime()
added Date and Server to httpd tasks
This commit is contained in:
2012-09-13 12:31:01 +00:00
parent adb9f387f9
commit 7466287f93
13 changed files with 214 additions and 71 deletions

View File

@ -63,6 +63,7 @@
#define QSE_SECNSEC_TO_MSEC(sec,nsec) \
(((qse_ntime_t)(sec) * QSE_MSECS_PER_SEC) + ((qse_ntime_t)(nsec) / QSE_NSECS_PER_MSEC))
#define QSE_SEC_TO_MSEC(sec) ((sec) * QSE_MSECS_PER_SEC)
/**
* The qse_ntime_t type defines a numeric time type expressed in the
* number of milliseconds since the Epoch (00:00:00 UTC, Jan 1, 1970).

View File

@ -181,12 +181,18 @@ int qse_parsehttprange (
);
/*
int qse_parsehttpdatetime (
int qse_parsehttptime (
const qse_mchar_t* str,
qse_ntime_t* t
);
*/
qse_mchar_t* qse_fmthttptime (
qse_ntime_t nt,
qse_mchar_t* buf,
qse_size_t bufsz
);
/* percent-decode a string */
qse_size_t qse_perdechttpstr (
const qse_mchar_t* str,

View File

@ -422,6 +422,38 @@ void qse_httpd_completecontent (
qse_htre_t* req
);
/**
* The qse_httpd_setname() function changes the string
* to be used as the value for the server header.
*/
void qse_httpd_setname (
qse_httpd_t* httpd,
const qse_mchar_t* name
);
/**
* The qse_httpd_getname() function returns the
* pointer to the string used as the value for the server
* header.
*/
qse_mchar_t* qse_httpd_getname (
qse_httpd_t* httpd
);
/**
* The qse_httpd_fmtgmtimetobb() function converts a numeric time @a nt
* to a string and stores it in a built-in buffer.
* If @a nt is QSE_NULL, the current time is used.
*/
const qse_mchar_t* qse_httpd_fmtgmtimetobb (
qse_httpd_t* httpd,
const qse_ntime_t* nt,
int idx
);
#define qse_httpd_gettaskxtn(httpd,task) ((void*)(task+1))
qse_httpd_task_t* qse_httpd_entask (
@ -506,6 +538,12 @@ qse_httpd_task_t* qse_httpd_entaskfile (
qse_htre_t* req
);
/**
* The qse_httpd_entaskphat() functions a dispatcher between
* qse_httpd_entaskdir() and qse_httpd_entaskfile(). It calls
* the former if @a name is a directory and calls the latter
* otherwise.
*/
qse_httpd_task_t* qse_httpd_entaskpath (
qse_httpd_t* httpd,
qse_httpd_client_t* client,