added fields to keep an original query path in qse_htre_t
changed proxying routines to use the original query path instead of percent-encoding back
This commit is contained in:
@ -79,8 +79,8 @@ struct qse_htre_t
|
||||
qse_http_method_t type;
|
||||
const qse_mchar_t* name;
|
||||
} method;
|
||||
qse_mchar_t* path;
|
||||
qse_mchar_t* param;
|
||||
qse_mcstr_t path;
|
||||
qse_mcstr_t param;
|
||||
} q;
|
||||
struct
|
||||
{
|
||||
@ -102,6 +102,17 @@ struct qse_htre_t
|
||||
#define QSE_HTRE_QPATH_PERDEC (1 << 6) /* the qpath has been percent-decoded */
|
||||
int flags;
|
||||
|
||||
/* original query path for a request.
|
||||
* meaningful if QSE_HTRE_QPATH_PERDEC is set in the flags */
|
||||
struct
|
||||
{
|
||||
qse_mchar_t* buf; /* buffer pointer */
|
||||
qse_size_t capa; /* buffer capacity */
|
||||
|
||||
qse_mchar_t* ptr;
|
||||
qse_size_t len;
|
||||
} orgqpath;
|
||||
|
||||
/* special attributes derived from the header */
|
||||
struct
|
||||
{
|
||||
@ -132,8 +143,9 @@ struct qse_htre_t
|
||||
#define qse_htre_getqmethodtype(re) ((re)->u.q.method.type)
|
||||
#define qse_htre_getqmethodname(re) ((re)->u.q.method.name)
|
||||
|
||||
#define qse_htre_getqpath(re) ((re)->u.q.path)
|
||||
#define qse_htre_getqparam(re) ((re)->u.q.param)
|
||||
#define qse_htre_getqpath(re) ((re)->u.q.path.ptr)
|
||||
#define qse_htre_getqparam(re) ((re)->u.q.param.ptr)
|
||||
#define qse_htre_getorgqpath(re) ((re)->orgqpath.ptr)
|
||||
|
||||
#define qse_htre_getscodeval(re) ((re)->u.s.code.val)
|
||||
#define qse_htre_getscodestr(re) ((re)->u.s.code.str)
|
||||
@ -169,18 +181,6 @@ QSE_EXPORT void qse_htre_clear (
|
||||
qse_htre_t* re
|
||||
);
|
||||
|
||||
QSE_EXPORT int qse_htre_setstrfromcstr (
|
||||
qse_htre_t* re,
|
||||
qse_mbs_t* str,
|
||||
const qse_mcstr_t* cstr
|
||||
);
|
||||
|
||||
QSE_EXPORT int qse_htre_setstrfromxstr (
|
||||
qse_htre_t* re,
|
||||
qse_mbs_t* str,
|
||||
const qse_mcstr_t* xstr
|
||||
);
|
||||
|
||||
QSE_EXPORT const qse_htre_hdrval_t* qse_htre_getheaderval (
|
||||
const qse_htre_t* re,
|
||||
const qse_mchar_t* key
|
||||
|
@ -202,22 +202,39 @@ QSE_EXPORT qse_mchar_t* qse_fmthttptime (
|
||||
qse_size_t bufsz
|
||||
);
|
||||
|
||||
/* percent-decode a string.
|
||||
* returns the number of affected characters.
|
||||
* for example, 0 means that no characters in the input required decoding. */
|
||||
QSE_EXPORT qse_size_t qse_perdechttpstr (
|
||||
const qse_mchar_t* str,
|
||||
qse_mchar_t* buf
|
||||
/**
|
||||
* The qse_isperencedhttpstr() function determines if the given string
|
||||
* contains a valid percent-encoded sequence.
|
||||
*/
|
||||
QSE_EXPORT int qse_isperencedhttpstr (
|
||||
const qse_mchar_t* str
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_perdechttpstr() function performs percent-decoding over a string.
|
||||
* The caller must ensure that the output buffer \a buf is large enough.
|
||||
* If \a ndecs is not #QSE_NULL, it is set to the number of characters
|
||||
* decoded. 0 means no characters in the input string required decoding
|
||||
* \return the length of the output string.
|
||||
*/
|
||||
QSE_EXPORT qse_size_t qse_perdechttpstr (
|
||||
const qse_mchar_t* str,
|
||||
qse_mchar_t* buf,
|
||||
qse_size_t* ndecs
|
||||
);
|
||||
|
||||
/* percent-encode a string.
|
||||
* returns the number of affected characters.
|
||||
* for example, 0 means that no characters in the input required encoding. */
|
||||
/**
|
||||
* The qse_perenchttpstr() function performs percent-encoding over a string.
|
||||
* The caller must ensure that the output buffer \a buf is large enough.
|
||||
* If \a nencs is not #QSE_NULL, it is set to the number of characters
|
||||
* encoded. 0 means no characters in the input string required encoding.
|
||||
* \return the length of the output string.
|
||||
*/
|
||||
QSE_EXPORT qse_size_t qse_perenchttpstr (
|
||||
int opt, /**< 0 or bitwise-OR'ed of #qse_perenchttpstr_opt_t */
|
||||
const qse_mchar_t* str,
|
||||
qse_mchar_t* buf
|
||||
qse_mchar_t* buf,
|
||||
qse_size_t* nencs
|
||||
);
|
||||
|
||||
QSE_EXPORT qse_mchar_t* qse_perenchttpstrdup (
|
||||
|
Reference in New Issue
Block a user