diff --git a/include/opendht/http.h b/include/opendht/http.h
index d131d0d50370e568e0c75cb49bfb6c45d3a7c001..71a9d78b6afd54b66ed248fbdbfb49ae11575930 100644
--- a/include/opendht/http.h
+++ b/include/opendht/http.h
@@ -25,8 +25,8 @@
 #include <asio/ssl.hpp>
 
 #include <restinio/all.hpp>
-#include <restinio/impl/tls_socket.hpp>
 
+#include <memory>
 #include <queue>
 
 extern "C" {
@@ -34,6 +34,12 @@ struct http_parser;
 struct http_parser_settings;
 }
 
+namespace restinio {
+namespace impl {
+class tls_socket_t;
+}
+}
+
 namespace dht {
 struct Logger;
 
diff --git a/src/http.cpp b/src/http.cpp
index a0db8eefbbad033381786e58252ca767ea0b192c..c0a6b831928b792ea9e8fa7d45865ce1762a79e1 100644
--- a/src/http.cpp
+++ b/src/http.cpp
@@ -20,6 +20,7 @@
 #include "log_enable.h"
 #include "crypto.h"
 
+#include <restinio/impl/tls_socket.hpp>
 #include <http_parser.h>
 
 namespace dht {