From b9fcf9d0d62d07cbf8e95185d89f6505629bfbfe Mon Sep 17 00:00:00 2001 From: Richard Aas Date: Fri, 7 Mar 2014 08:09:51 +0000 Subject: [PATCH] http: added http_sock_tcp() --- include/re_http.h | 1 + src/http/server.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) 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 *