fixed a bug of not resetting htre's flags field when clearing it
This commit is contained in:
parent
c5001505cd
commit
ca272bb55e
@ -144,6 +144,11 @@ server-default {
|
|||||||
|
|
||||||
#pseudonym = "nice-host";
|
#pseudonym = "nice-host";
|
||||||
|
|
||||||
|
# TOOD: add-headers and remove-headers
|
||||||
|
#add-headers = "X-Forwarded-For: ${Client_Ipaddr}",
|
||||||
|
# "X-Forwarded-Proto: ${Client-Proto}";
|
||||||
|
#remove-headers = "Connection";
|
||||||
|
|
||||||
dns-enabled = yes; # yes/on, no/off
|
dns-enabled = yes; # yes/on, no/off
|
||||||
dns-server = "192.168.1.1:53";
|
dns-server = "192.168.1.1:53";
|
||||||
#dns-server = "[::1]:53";
|
#dns-server = "[::1]:53";
|
||||||
|
@ -40,6 +40,7 @@ enum qse_htre_state_t
|
|||||||
QSE_HTRE_DISCARDED = (1 << 0), /** content has been discarded */
|
QSE_HTRE_DISCARDED = (1 << 0), /** content has been discarded */
|
||||||
QSE_HTRE_COMPLETED = (1 << 1) /** complete content has been seen */
|
QSE_HTRE_COMPLETED = (1 << 1) /** complete content has been seen */
|
||||||
};
|
};
|
||||||
|
typedef enum qse_htre_state_t qse_htre_state_t;
|
||||||
|
|
||||||
typedef int (*qse_htre_concb_t) (
|
typedef int (*qse_htre_concb_t) (
|
||||||
qse_htre_t* re,
|
qse_htre_t* re,
|
||||||
@ -92,7 +93,6 @@ struct qse_htre_t
|
|||||||
} s;
|
} s;
|
||||||
} u;
|
} u;
|
||||||
|
|
||||||
|
|
||||||
#define QSE_HTRE_ATTR_CHUNKED (1 << 0)
|
#define QSE_HTRE_ATTR_CHUNKED (1 << 0)
|
||||||
#define QSE_HTRE_ATTR_LENGTH (1 << 1)
|
#define QSE_HTRE_ATTR_LENGTH (1 << 1)
|
||||||
#define QSE_HTRE_ATTR_KEEPALIVE (1 << 2)
|
#define QSE_HTRE_ATTR_KEEPALIVE (1 << 2)
|
||||||
@ -120,7 +120,7 @@ struct qse_htre_t
|
|||||||
qse_htre_concb_t concb;
|
qse_htre_concb_t concb;
|
||||||
void* concb_ctx;
|
void* concb_ctx;
|
||||||
|
|
||||||
/* ORed of qse_htre_state_t */
|
/* bitwise-ORed of qse_htre_state_t */
|
||||||
int state;
|
int state;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -93,6 +93,7 @@ void qse_htre_clear (qse_htre_t* re)
|
|||||||
}
|
}
|
||||||
|
|
||||||
re->state = 0;
|
re->state = 0;
|
||||||
|
re->flags = 0;
|
||||||
|
|
||||||
QSE_MEMSET (&re->version, 0, QSE_SIZEOF(re->version));
|
QSE_MEMSET (&re->version, 0, QSE_SIZEOF(re->version));
|
||||||
QSE_MEMSET (&re->attr, 0, QSE_SIZEOF(re->attr));
|
QSE_MEMSET (&re->attr, 0, QSE_SIZEOF(re->attr));
|
||||||
@ -104,7 +105,6 @@ void qse_htre_clear (qse_htre_t* re)
|
|||||||
#if 0
|
#if 0
|
||||||
qse_mbs_clear (&re->iniline);
|
qse_mbs_clear (&re->iniline);
|
||||||
#endif
|
#endif
|
||||||
re->state = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int qse_htre_setstrfromcstr (
|
int qse_htre_setstrfromcstr (
|
||||||
@ -268,7 +268,9 @@ int qse_htre_perdecqpath (qse_htre_t* re)
|
|||||||
{
|
{
|
||||||
/* percent decode the query path */
|
/* percent decode the query path */
|
||||||
if (re->type != QSE_HTRE_Q || (re->flags & QSE_HTRE_QPATH_PERDEC)) return -1;
|
if (re->type != QSE_HTRE_Q || (re->flags & QSE_HTRE_QPATH_PERDEC)) return -1;
|
||||||
if (qse_perdechttpstr ((re)->u.q.path, (re)->u.q.path) > 0)
|
if (qse_perdechttpstr (re->u.q.path, re->u.q.path) > 0)
|
||||||
|
{
|
||||||
re->flags |= QSE_HTRE_QPATH_PERDEC;
|
re->flags |= QSE_HTRE_QPATH_PERDEC;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -806,7 +806,7 @@ static int read_pair (qse_xli_t* xli, const qse_char_t* keytag)
|
|||||||
{
|
{
|
||||||
/* check the value type */
|
/* check the value type */
|
||||||
qse_xli_seterror (xli, QSE_XLI_EILVAL, (const qse_cstr_t*)&key, &kloc);
|
qse_xli_seterror (xli, QSE_XLI_EILVAL, (const qse_cstr_t*)&key, &kloc);
|
||||||
goto oops;
|
goto oops;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add a new pair with the initial string segment */
|
/* add a new pair with the initial string segment */
|
||||||
@ -892,7 +892,7 @@ static int read_pair (qse_xli_t* xli, const qse_char_t* keytag)
|
|||||||
{
|
{
|
||||||
/* check the value type */
|
/* check the value type */
|
||||||
qse_xli_seterror (xli, QSE_XLI_EILVAL, (const qse_cstr_t*)&key, &kloc);
|
qse_xli_seterror (xli, QSE_XLI_EILVAL, (const qse_cstr_t*)&key, &kloc);
|
||||||
goto oops;
|
goto oops;
|
||||||
}
|
}
|
||||||
|
|
||||||
xli->tok_status &= ~TOK_STATUS_ENABLE_NSTR;
|
xli->tok_status &= ~TOK_STATUS_ENABLE_NSTR;
|
||||||
@ -925,7 +925,7 @@ static int read_pair (qse_xli_t* xli, const qse_char_t* keytag)
|
|||||||
if (xli->opt.trait & QSE_XLI_NONIL)
|
if (xli->opt.trait & QSE_XLI_NONIL)
|
||||||
{
|
{
|
||||||
qse_xli_seterror (xli, QSE_XLI_ENOVAL, (const qse_cstr_t*)&key, &kloc);
|
qse_xli_seterror (xli, QSE_XLI_ENOVAL, (const qse_cstr_t*)&key, &kloc);
|
||||||
goto oops;
|
goto oops;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scm && !(scm->flags & QSE_XLI_SCM_VALNIL) &&
|
if (scm && !(scm->flags & QSE_XLI_SCM_VALNIL) &&
|
||||||
@ -950,7 +950,7 @@ static int read_pair (qse_xli_t* xli, const qse_char_t* keytag)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
qse_xli_seterror (xli, QSE_XLI_ELBREQ, QSE_STR_XSTR(xli->tok.name), &xli->tok.loc);
|
qse_xli_seterror (xli, QSE_XLI_ELBREQ, QSE_STR_XSTR(xli->tok.name), &xli->tok.loc);
|
||||||
goto oops;
|
goto oops;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strtag) QSE_MMGR_FREE (xli->mmgr, strtag);
|
if (strtag) QSE_MMGR_FREE (xli->mmgr, strtag);
|
||||||
@ -980,7 +980,7 @@ static qse_xli_list_link_t* make_list_link (qse_xli_t* xli, qse_xli_list_t* parl
|
|||||||
link->next = xli->parlink;
|
link->next = xli->parlink;
|
||||||
xli->parlink = link;
|
xli->parlink = link;
|
||||||
|
|
||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_list_link (qse_xli_t* xli, qse_xli_list_link_t* link)
|
static void free_list_link (qse_xli_t* xli, qse_xli_list_link_t* link)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user