new function: uh_get_method(), uh_get_method_str()
Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>main
parent
519559c12f
commit
6bc0e5fa16
|
@ -103,6 +103,8 @@ int uh_register_hook(struct uh_server *srv, const char *path, uh_hookfn_t cb);
|
||||||
*/
|
*/
|
||||||
void uh_register_default_hook(struct uh_server *srv, uh_hookfn_t cb);
|
void uh_register_default_hook(struct uh_server *srv, uh_hookfn_t cb);
|
||||||
|
|
||||||
|
enum http_method uh_get_method(struct uh_connection *con);
|
||||||
|
const char *uh_get_method_str(struct uh_connection *con);
|
||||||
struct uh_str *uh_get_url(struct uh_connection *con);
|
struct uh_str *uh_get_url(struct uh_connection *con);
|
||||||
struct uh_str *uh_get_path(struct uh_connection *con);
|
struct uh_str *uh_get_path(struct uh_connection *con);
|
||||||
struct uh_str *uh_get_query(struct uh_connection *con);
|
struct uh_str *uh_get_query(struct uh_connection *con);
|
||||||
|
|
10
src/uhttp.c
10
src/uhttp.c
|
@ -567,6 +567,16 @@ void uh_register_default_hook(struct uh_server *srv, uh_hookfn_t cb)
|
||||||
srv->default_cb = cb;
|
srv->default_cb = cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum http_method uh_get_method(struct uh_connection *con)
|
||||||
|
{
|
||||||
|
return con->parser.method;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *uh_get_method_str(struct uh_connection *con)
|
||||||
|
{
|
||||||
|
return http_method_str(con->parser.method);
|
||||||
|
}
|
||||||
|
|
||||||
inline struct uh_str *uh_get_url(struct uh_connection *con)
|
inline struct uh_str *uh_get_url(struct uh_connection *con)
|
||||||
{
|
{
|
||||||
return &con->req.url;
|
return &con->req.url;
|
||||||
|
|
Loading…
Reference in New Issue