From: W.C.A. Wijngaards Date: Tue, 30 Jun 2026 10:14:00 +0000 (+0200) Subject: - Fix #1469: dohclient: DoH POST missing content-length → :status X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=672b9659cf711c753073105c41fd2770b07edb16;p=thirdparty%2Funbound.git - Fix #1469: dohclient: DoH POST missing content-length → :status 400 from strict resolvers (Cloudflare, Mullvad). --- diff --git a/doc/Changelog b/doc/Changelog index 6a68008cb..9626562e5 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,7 @@ +30 June 2026: Wouter + - Fix #1469: dohclient: DoH POST missing content-length → :status + 400 from strict resolvers (Cloudflare, Mullvad). + 26 June 2026: Wouter - Merge #1467: daemon: fix DEREF_AFTER_NULL.EX.COND on worker_init. This fixes error handling if the worker diff --git a/testcode/dohclient.c b/testcode/dohclient.c index 8d8adaf5d..08250ef3a 100644 --- a/testcode/dohclient.c +++ b/testcode/dohclient.c @@ -146,7 +146,9 @@ submit_query(struct http2_session* h2_session, struct sldns_buffer* buf) { int32_t stream_id; struct http2_stream* h2_stream; - nghttp2_nv headers[5]; + nghttp2_nv headers[6]; + size_t num_headers = 5; + char clen[16]; char* qb64; size_t qb64_size; size_t qb64_expected_size; @@ -194,9 +196,16 @@ submit_query(struct http2_session* h2_session, struct sldns_buffer* buf) headers[3].value = (uint8_t*)h2_session->authority; headers[4].name = (uint8_t*)"content-type"; headers[4].value = (uint8_t*)h2_session->content_type; + if(h2_session->post) { + snprintf(clen, sizeof(clen), "%u", + (unsigned)sldns_buffer_remaining(buf)); + headers[5].name = (uint8_t*)"content-length"; + headers[5].value = (uint8_t*)clen; + num_headers = 6; + } printf("Request headers\n"); - for(i=0; isession, NULL, headers, - sizeof(headers)/sizeof(headers[0]), + num_headers, (h2_session->post) ? &data_prd : NULL, h2_stream); if(stream_id < 0) { printf("Failed to submit nghttp2 request");