added QSE_HTTPD_SERVERSTD_EXPECT100

This commit is contained in:
hyung-hwan 2013-03-22 12:45:39 +00:00
parent 0ae8ba8f28
commit d5603febaa
3 changed files with 34 additions and 5 deletions

View File

@ -427,6 +427,11 @@ static int query_server (
ssl->keyfile = server_xtn->scfg[SCFG_SSLKEYFILE];
return 0;
}
else if (code == QSE_HTTPD_SERVERSTD_EXPECT100)
{
*(int*)result = 100;
return 0;
}
if (req)
{
@ -460,6 +465,7 @@ static int query_server (
switch (code)
{
case QSE_HTTPD_SERVERSTD_NAME:
*(const qse_mchar_t**)result = loccfg->xcfg[XCFG_NAME];
return 0;

View File

@ -99,6 +99,7 @@ struct qse_httpd_serverstd_ssl_t
enum qse_httpd_serverstd_query_code_t
{
QSE_HTTPD_SERVERSTD_SSL, /* qse_httpd_serverstd_ssl_t */
QSE_HTTPD_SERVERSTD_EXPECT100, /* int (http error code) */
QSE_HTTPD_SERVERSTD_NAME, /* const qse_mchar_t* */
QSE_HTTPD_SERVERSTD_ROOT, /* qse_httpd_serverstd_root_t */
@ -111,7 +112,7 @@ enum qse_httpd_serverstd_query_code_t
QSE_HTTPD_SERVERSTD_CGI, /* qse_httpd_serverstd_cgi_t */
QSE_HTTPD_SERVERSTD_MIME, /* const qse_mchar_t* */
QSE_HTTPD_SERVERSTD_DIRACC, /* int (http error code) */
QSE_HTTPD_SERVERSTD_FILEACC /* int (http error code) */
QSE_HTTPD_SERVERSTD_FILEACC, /* int (http error code) */
};
typedef enum qse_httpd_serverstd_query_code_t qse_httpd_serverstd_query_code_t;

View File

@ -1878,13 +1878,31 @@ if (qse_htre_getcontentlen(req) > 0)
(req->version.major == 1 && req->version.minor >= 1)) &&
!content_received)
{
/* TODO: check method.... */
/* "expect" in the header, version 1.1 or higher,
int code;
/* "Expect: 100-Continue" in the header, version 1.1 or higher,
* and no content received yet */
if (server_xtn->query (httpd, client->server, req, QSE_NULL, QSE_HTTPD_SERVERSTD_EXPECT100, &code) <= -1) return -1;
/* TODO: determine if to return 100-continue or other errors */
if (qse_httpd_entaskcontinue (
httpd, client, QSE_NULL, req) == QSE_NULL) return -1;
if (code == 100)
{
if (qse_httpd_entaskcontinue (httpd, client, QSE_NULL, req) == QSE_NULL) return -1;
}
else if (code == 417)
{
/* if expectation fails, the client must not send the contents.
* however, some erroneous clients may do that.
* calling qse_httpd_discardcontent() won't do any harms */
/*
if (qse_httpd_entaskexpectfailure (httpd, client, QSE_NULL, req) == QSE_NULL) return -1;
*/
qse_httpd_discardcontent (httpd, req);
}
/* if 200, ignore "Expect: 100-Continue" */
}
}
@ -2688,6 +2706,10 @@ static int query_server (
qse_httpd_seterrnum (httpd, QSE_HTTPD_ENOENT);
return -1;
case QSE_HTTPD_SERVERSTD_EXPECT100:
*(int*)result = 100;
break;
case QSE_HTTPD_SERVERSTD_NAME:
*(const qse_mchar_t**)result = QSE_NULL;
break;