Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(http): Clarify Trailer support, partial support for Server-Timing in Fx devtools only #25141

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bsmth
Copy link
Member

@bsmth bsmth commented Nov 20, 2024

Summary

The support for HTTP Trailer header is misleading, as it's removed from the Fetch spec & not accessible there anyway / XHR. As far as I can see, the only support that exists in browsers is exclusively for Server-Timing, and at that, it's only used for DevTools in Network -> Timing, all other headers (as trailers) are a no-op / discarded. For this reason, I've set it to partial support for Trailer, and full support for Server-Timing header as trailer, which no other browser appears to do.

Test results and supporting details

Node repro:

const http = require("http");
http
  .createServer((req, res) => {
    res.writeHead(200, {
      "Content-Type": "text/plain",
      "Transfer-Encoding": "chunked",
      // Server-Timing as header
      // "Server-Timing": "custom-metric;dur=567.123",
      Trailer: "Server-Timing",
    });
    res.write("Hello.\n");
    // Server-Timing as trailer
    // See https://nodejs.org/api/http.html#responseaddtrailersheaders
    res.addTrailers({
      "Server-Timing": "custom-metric;dur=666.123",
    });
    res.end();
  })
  .listen(3000, () => {
    console.log("Server running at http://localhost:3000");
  });

Related issues

@github-actions github-actions bot added the data:http 🚠 Compat data for HTTP features. https://developer.mozilla.org/docs/Web/HTTP label Nov 20, 2024
@github-actions github-actions bot added the size:m [PR only] 25-100 LoC changed label Nov 20, 2024
@caugner
Copy link
Contributor

caugner commented Nov 21, 2024

FWIW I only found this indirectly related WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=178069

Copy link
Contributor

@caugner caugner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Compact diff grouped by file:
image

Copy link
Contributor

@caugner caugner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nit.

"description": "`Server-Timing` as HTTP trailer",
"support": {
"chrome": {
"version_added": false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, we should probably add the Chromium impl_url here:

https://issues.chromium.org/issues/40811358

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:http 🚠 Compat data for HTTP features. https://developer.mozilla.org/docs/Web/HTTP size:m [PR only] 25-100 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants