uh_get_con_sock(): New function

Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
main
Jianhui Zhao 2017-12-05 15:52:27 +08:00
parent cb5cfff75b
commit 519559c12f
2 changed files with 7 additions and 0 deletions

View File

@ -109,6 +109,8 @@ struct uh_str *uh_get_query(struct uh_connection *con);
struct uh_str uh_get_var(struct uh_connection *con, const char *name); struct uh_str uh_get_var(struct uh_connection *con, const char *name);
struct uh_str *uh_get_header(struct uh_connection *con, const char *name); struct uh_str *uh_get_header(struct uh_connection *con, const char *name);
int uh_get_con_sock(struct uh_connection *con);
/* Unescapes strings like '%7B1,%202,%203%7D' would become '{1, 2, 3}' */ /* Unescapes strings like '%7B1,%202,%203%7D' would become '{1, 2, 3}' */
int uh_unescape(const char *str, int len, char *out, int olen); int uh_unescape(const char *str, int len, char *out, int olen);

View File

@ -582,6 +582,11 @@ inline struct uh_str *uh_get_query(struct uh_connection *con)
return &con->req.query; return &con->req.query;
} }
int uh_get_con_sock(struct uh_connection *con)
{
return con->sock;
}
static inline char c2hex(char c) static inline char c2hex(char c)
{ {
return c >= '0' && c <= '9' ? c - '0' : c >= 'A' && c <= 'F' ? c - 'A' + 10 : c - 'a' + 10; /* accept small letters just in case */ return c >= '0' && c <= '9' ? c - '0' : c >= 'A' && c <= 'F' ? c - 'A' + 10 : c - 'a' + 10; /* accept small letters just in case */