]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/http: document header_callback
authorTomas Krizek <tomas.krizek@nic.cz>
Thu, 20 Aug 2020 14:13:35 +0000 (16:13 +0200)
committerTomas Krizek <tomas.krizek@nic.cz>
Tue, 13 Oct 2020 10:55:26 +0000 (12:55 +0200)
daemon/http.c

index 21da458797447a93265ce103dbf99ee303b0fc3c..757226a524e7ccd219ce428d61e3ad8cf71b333b 100644 (file)
@@ -176,6 +176,15 @@ static void refuse_stream(nghttp2_session *h2, int32_t stream_id)
                h2, NGHTTP2_FLAG_NONE, stream_id, NGHTTP2_REFUSED_STREAM);
 }
 
+/*
+ * Process a received header name-value pair.
+ *
+ * In DoH, GET requests contain the base64url-encoded query in dns variable present in path.
+ * This variable is parsed from :path pseudoheader.
+ *
+ * Since we don't need any headers for POST request, avoid processing them entirely to
+ * avoid potential issues if dns variable would be present in path.
+ */
 static int header_callback(nghttp2_session *h2, const nghttp2_frame *frame,
                           const uint8_t *name, size_t namelen, const uint8_t *value,
                           size_t valuelen, uint8_t flags, void *user_data)
@@ -188,7 +197,6 @@ static int header_callback(nghttp2_session *h2, const nghttp2_frame *frame,
        if ((frame->hd.flags & NGHTTP2_FLAG_END_STREAM) == 0)
                return 0;
 
-       /* If there is incomplete data in the buffer, we can't process the new stream. */
        if (ctx->incomplete_stream) {
                kr_log_verbose("[http] previous stream incomplete, refusing\n");
                refuse_stream(h2, stream_id);