Skip to content

Commit b547030

Browse files
xianren78pymumu
authored andcommitted
Add "Accept: application/dns-message" as for RFC 8484 Guidance
The DoH client SHOULD include an HTTP Accept request header field to indicate what type of content can be understood in response. Irrespective of the value of the Accept request header field, the client MUST be prepared to process "application/dns-message" (as described in Section 6) responses but MAY also process other DNS-related media types it receives.
1 parent 0cfa5d6 commit b547030

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/dns_client/client_http3.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ int _dns_client_send_http3(struct dns_query_struct *query, struct dns_server_inf
5252
http_head_add_fields(http_head, ":authority", https_flag->httphost);
5353
http_head_add_fields(http_head, "user-agent", "smartdns");
5454
http_head_add_fields(http_head, "content-type", "application/dns-message");
55+
http_head_add_fields(http_head, "accept", "application/dns-message");
5556
http_head_add_fields(http_head, "accept-encoding", "identity");
5657
http_head_set_data(http_head, packet, len);
5758

@@ -138,4 +139,4 @@ int _dns_client_process_recv_http3(struct dns_server_info *server_info, struct d
138139

139140
return -1;
140141
}
141-
#endif
142+
#endif

src/dns_client/client_https.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ int _dns_client_send_https(struct dns_server_info *server_info, void *packet, un
4444
"Host: %s\r\n"
4545
"User-Agent: smartdns\r\n"
4646
"Content-Type: application/dns-message\r\n"
47+
"Accept: application/dns-message\r\n"
4748
"Content-Length: %d\r\n"
4849
"\r\n",
4950
https_flag->path, https_flag->httphost, len);

0 commit comments

Comments
 (0)