From: Tomas Krizek Date: Wed, 30 Sep 2020 12:09:32 +0000 (+0200) Subject: daemon/http: remove plain HTTP implementation artifacts X-Git-Tag: v5.2.0~15^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f30ab93527a253a8bb72758da0187251308536bb;p=thirdparty%2Fknot-resolver.git daemon/http: remove plain HTTP implementation artifacts --- diff --git a/daemon/bindings/net.c b/daemon/bindings/net.c index b84c095b4..d2e223765 100644 --- a/daemon/bindings/net.c +++ b/daemon/bindings/net.c @@ -117,7 +117,7 @@ static bool net_listen_addrs(lua_State *L, int port, bool tls, bool http, const flags.sock_type = SOCK_DGRAM; ret = network_listen(net, str, port, flags); } - if (!kind && ret == 0) { /* common for normal TCP and TLS */ + if (!kind && ret == 0) { /* common for TCP, DoT and DoH (v2) */ flags.sock_type = SOCK_STREAM; ret = network_listen(net, str, port, flags); } @@ -184,7 +184,7 @@ static int net_listen(lua_State *L) } bool tls = (port == KR_DNS_TLS_PORT); - bool http = (port == KR_DNS_HTTP_PORT); + bool http = false; if (port == KR_DNS_DOH_PORT) { http = tls = true; } diff --git a/daemon/io.c b/daemon/io.c index 8de8e3e0d..fff465ba2 100644 --- a/daemon/io.c +++ b/daemon/io.c @@ -455,7 +455,7 @@ static void _tcp_accept(uv_stream_t *master, int status, bool tls, bool http) if (http) { struct http_ctx *ctx = session_http_get_server_ctx(s); if (!ctx) { - if (!tls) { // TODO plain HTTP not supported yet + if (!tls) { /* Plain HTTP is not supported. */ session_close(s); return; } @@ -481,11 +481,6 @@ static void tls_accept(uv_stream_t *master, int status) _tcp_accept(master, status, true, false); } -static void http_accept(uv_stream_t *master, int status) -{ - _tcp_accept(master, status, false, true); -} - static void https_accept(uv_stream_t *master, int status) { _tcp_accept(master, status, true, true); @@ -495,11 +490,16 @@ int io_listen_tcp(uv_loop_t *loop, uv_tcp_t *handle, int fd, int tcp_backlog, bo { uv_connection_cb connection; if (has_tls && has_http) { +#ifdef NGHTTP2_VERSION_NUM connection = https_accept; +#else + kr_log_error("[ io ] kresd was compiled without libnghttp2 support"); + return kr_error(ENOPROTOOPT); +#endif } else if (has_tls) { connection = tls_accept; } else if (has_http) { - connection = http_accept; + return kr_error(EPROTONOSUPPORT); } else { connection = tcp_accept; } diff --git a/lib/defines.h b/lib/defines.h index 2b13b7695..4e7c9291b 100644 --- a/lib/defines.h +++ b/lib/defines.h @@ -59,7 +59,6 @@ static inline int KR_COLD kr_error(int x) { * Defines. */ #define KR_DNS_PORT 53 -#define KR_DNS_HTTP_PORT 80 #define KR_DNS_DOH_PORT 443 #define KR_DNS_TLS_PORT 853 #define KR_EDNS_VERSION 0