]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/http: remove plain HTTP implementation artifacts
authorTomas Krizek <tomas.krizek@nic.cz>
Wed, 30 Sep 2020 12:09:32 +0000 (14:09 +0200)
committerTomas Krizek <tomas.krizek@nic.cz>
Tue, 13 Oct 2020 10:55:29 +0000 (12:55 +0200)
daemon/bindings/net.c
daemon/io.c
lib/defines.h

index b84c095b4e9acc365825493a1d8b533b512fe21d..d2e2237657d4b52c7e9e3c915d43517df3f68469 100644 (file)
@@ -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;
        }
index 8de8e3e0d993c7bbb43a6f01c443fc9146598caa..fff465ba2495fc2269d7c90e1347f78db150219e 100644 (file)
@@ -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;
        }
index 2b13b7695de02bab1a39ad531a5061dfebeb0b8c..4e7c9291b3a499a080ace8c0819bf4b87ab8cb89 100644 (file)
@@ -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