summaryrefslogtreecommitdiffstats
path: root/daemon
diff options
context:
space:
mode:
Diffstat (limited to 'daemon')
-rw-r--r--daemon/http.c2
-rw-r--r--daemon/session2.h7
-rw-r--r--daemon/worker.c4
3 files changed, 6 insertions, 7 deletions
diff --git a/daemon/http.c b/daemon/http.c
index 8633c664..d028113b 100644
--- a/daemon/http.c
+++ b/daemon/http.c
@@ -877,7 +877,7 @@ static int pl_http_sess_init(struct protolayer_manager *manager,
struct sockaddr *peer = session2_get_peer(manager->session);
kr_log_debug(DOH, "[%p] h2 session created for %s\n", (void *)http->h2, kr_straddr(peer));
- manager->session->http = true;
+ manager->session->custom_emalf_handling = true;
ret = kr_ok();
diff --git a/daemon/session2.h b/daemon/session2.h
index 4f07cb49..392e1935 100644
--- a/daemon/session2.h
+++ b/daemon/session2.h
@@ -842,9 +842,10 @@ struct session2 {
* Set during protocol layer initialization by the stream-based layer. */
bool stream : 1;
- /** If true, the session contains a HTTP protocol layer.
- * Set during protocol layer initialization by the HTTP layer. */
- bool http : 1;
+ /** If true, the session contains a protocol layer with custom handling
+ * of malformed queries. This is used e.g. by the HTTP layer, which will
+ * return a Bad Request status on a malformed query. */
+ bool custom_emalf_handling : 1;
/** If true, a connection is established. Only applicable to sessions
* using connection-based protocols. One of the stream-based protocol
diff --git a/daemon/worker.c b/daemon/worker.c
index 996eb9be..db63f025 100644
--- a/daemon/worker.c
+++ b/daemon/worker.c
@@ -1351,9 +1351,7 @@ static int worker_submit(struct session2 *session, struct comm_info *comm, knot_
}
/* Badly formed query when using DoH leads to a Bad Request */
- /* TODO: Do not necessarily tie it to HTTP - it should probably be a
- * more generic flag */
- if (session->http && !is_outgoing && ret) {
+ if (session->custom_emalf_handling && !is_outgoing && ret) {
session2_event(session, PROTOLAYER_EVENT_MALFORMED, NULL);
return ret;
}