diff --git a/include/re_http.h b/include/re_http.h index 853fa3e..2cdcd0d 100644 --- a/include/re_http.h +++ b/include/re_http.h @@ -135,6 +135,7 @@ int http_listen(struct http_sock **sockp, const struct sa *laddr, http_req_h *reqh, void *arg); int https_listen(struct http_sock **sockp, const struct sa *laddr, const char *cert, http_req_h *reqh, void *arg); +struct tcp_sock *http_sock_tcp(struct http_sock *sock); const struct sa *http_conn_peer(const struct http_conn *conn); struct tcp_conn *http_conn_tcp(struct http_conn *conn); struct tls_conn *http_conn_tls(struct http_conn *conn); diff --git a/src/http/server.c b/src/http/server.c index e9762d2..db63c06 100644 --- a/src/http/server.c +++ b/src/http/server.c @@ -319,6 +319,19 @@ int https_listen(struct http_sock **sockp, const struct sa *laddr, } +/** + * Get the TCP socket of an HTTP socket + * + * @param sock HTTP socket + * + * @return TCP socket + */ +struct tcp_sock *http_sock_tcp(struct http_sock *sock) +{ + return sock ? sock->ts : NULL; +} + + /** * Get the peer address of an HTTP connection *