Skip to content

fetch can send conflicting :authority and host headers on HTTP/2 #32140

Description

@magurotuna

Problem

using client = Deno.createHttpClient({ allowHost: true });
const res = await fetch("https://example.com", {
  client,
  headers: {
    host: "example.net",
  },
});
console.log(res.status);

We expect this code to send :authority = example.net (instead of example.com). But what's actually sent is :authority = example.com and host = example.net, which violates the HTTP/2 RFC (see RFC 9113 §8.3.1).

Here is the wireshark screenshot, showing the request made by the script above contained conflicting :authority and host

wireshark

Additional info

Version: Deno 2.6.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions