fixed the problem of no percent-encoding of decoded query path in proxying

This commit is contained in:
2014-09-17 13:26:21 +00:00
parent 94f015ea98
commit f84b27c1de
12 changed files with 174 additions and 93 deletions

View File

@ -92,16 +92,19 @@ struct qse_htre_t
} s;
} u;
/* special attributes derived from the header */
struct
{
#define QSE_HTRE_ATTR_CHUNKED (1 << 0)
#define QSE_HTRE_ATTR_LENGTH (1 << 1)
#define QSE_HTRE_ATTR_KEEPALIVE (1 << 2)
#define QSE_HTRE_ATTR_EXPECT (1 << 3)
#define QSE_HTRE_ATTR_EXPECT100 (1 << 4)
#define QSE_HTRE_ATTR_PROXIED (1 << 5)
int flags;
#define QSE_HTRE_QPATH_PERDEC (1 << 6) /* the qpath has been percent-decoded */
int flags;
/* special attributes derived from the header */
struct
{
qse_size_t content_length;
const qse_mchar_t* status; /* for cgi */
} attr;
@ -231,6 +234,10 @@ QSE_EXPORT void qse_htre_setconcb (
void* ctx
);
QSE_EXPORT int qse_htre_perdecqpath (
qse_htre_t* req
);
#ifdef __cplusplus
}
#endif

View File

@ -154,6 +154,13 @@ struct qse_http_range_t
};
typedef struct qse_http_range_t qse_http_range_t;
enum qse_perenchttpstr_opt_t
{
QSE_PERENCHTTPSTR_KEEP_SLASH = (1 << 0)
};
typedef enum qse_perenchttpstr_opt_t qse_perenchttpstr_opt_t;
#ifdef __cplusplus
extern "C" {
#endif
@ -195,20 +202,26 @@ QSE_EXPORT qse_mchar_t* qse_fmthttptime (
qse_size_t bufsz
);
/* percent-decode a string */
/* 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
);
/* percent-encode a string */
/* percent-encode a string.
* returns the number of affected characters.
* for example, 0 means that no characters in the input required encoding. */
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_EXPORT qse_mchar_t* qse_perenchttpstrdup (
int opt, /**< 0 or bitwise-OR'ed of #qse_perenchttpstr_opt_t */
const qse_mchar_t* str,
qse_mmgr_t* mmgr
);