RESOLVED INVALID263931
Web Inspector: Change the format for Copy HTTP Response/Request headers
https://bugs.webkit.org/show_bug.cgi?id=263931
Summary Web Inspector: Change the format for Copy HTTP Response/Request headers
Karl Dubost
Reported 2023-10-30 15:53:11 PDT
1. Go to http://example.org/ 2. Open Web Inspector 3. Open Network Tab 4. Copy HTTP Request 5. Copy HTTP Response This gives the following results: HTTP Request GET / HTTP/1.1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding: gzip, deflate Upgrade-Insecure-Requests: 1 Host: www.example.org User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Safari/605.1.15 Referer: https://www.google.com/ Accept-Language: en-US,en;q=0.9 Connection: keep-alive HTTP/1.1 200 OK Content-Type: text/html; charset=UTF-8 Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT Age: 336899 Content-Encoding: gzip Expires: Mon, 06 Nov 2023 22:43:13 GMT Cache-Control: max-age=604800 Date: Mon, 30 Oct 2023 22:43:13 GMT Content-Length: 648 ETag: "3147526947+gzip" Vary: Accept-Encoding Server: ECS (sac/2575) X-Cache: HIT So far so good. Let's do the same thing on https://apple.com/ which is HTTP/2 HTTP Request :method: GET :scheme: https :authority: www.apple.com :path: / Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Sec-Fetch-Site: none Cookie: **** Accept-Encoding: gzip, deflate, br Sec-Fetch-Mode: navigate Host: www.apple.com User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Safari/605.1.15 Accept-Language: en-US,en;q=0.9 Sec-Fetch-Dest: document Connection: keep-alive and the HTTP Response: :status: 200 Content-Type: text/html; charset=utf-8 Vary: Accept-Encoding Content-Security-Policy: ******* X-XSS-Protection: 1; mode=block Content-Encoding: gzip Expires: Mon, 30 Oct 2023 22:46:56 GMT Referrer-Policy: no-referrer-when-downgrade Cache-Control: max-age=94 Date: Mon, 30 Oct 2023 22:45:22 GMT X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN Server: Apple Strict-Transport-Security: max-age=31536000; includeSubdomains; preload x-cache: ***** It would probably be better for consistency to display it as GET / HTTP/2 Host: www.apple.com User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:120.0) Gecko/20100101 Firefox/120.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8 Accept-Language: en-US,en;q=0.7,fr-FR;q=0.3 Accept-Encoding: gzip, deflate, br Connection: keep-alive Cookie: ***** Upgrade-Insecure-Requests: 1 Sec-Fetch-Dest: document Sec-Fetch-Mode: navigate Sec-Fetch-Site: cross-site Pragma: no-cache Cache-Control: no-cache TE: trailers HTTP/2 200 server: Apple content-type: text/html; charset=utf-8 x-frame-options: SAMEORIGIN vary: Accept-Encoding content-security-policy: ******* referrer-policy: no-referrer-when-downgrade strict-transport-security: max-age=31536000; includeSubdomains; preload x-content-type-options: nosniff x-xss-protection: 1; mode=block content-encoding: gzip cache-control: max-age=36 expires: Mon, 30 Oct 2023 22:50:00 GMT date: Mon, 30 Oct 2023 22:49:24 GMT x-cache: ****** X-Firefox-Spdy: h2
Attachments
Radar WebKit Bug Importer
Comment 1 2023-10-30 15:53:23 PDT
Karl Dubost
Comment 2 2024-10-14 23:51:47 PDT
The menu is defined on https://github.com/WebKit/WebKit/blob/259a471d12137011bc115533fbc94bd2060fa9a7/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js#L197-L200 Then it is using stringifyHTTPResponse https://github.com/WebKit/WebKit/blob/259a471d12137011bc115533fbc94bd2060fa9a7/Source/WebInspectorUI/UserInterface/Models/Resource.js#L1272C5-L1291C6 which has hardcoded `:status:` ``` lines.push(`:status: ${this.statusCode}`); ``` hmm I see the rationale there to use the response defined in HTTP/2 ``` stringifyHTTPResponse() { let lines = []; let protocol = this.protocol || ""; if (protocol === "h2") { // HTTP/2 Response pseudo headers: // https://tools.ietf.org/html/rfc7540#section-8.1.2.4 lines.push(`:status: ${this.statusCode}`); } else { // HTTP/1.1 response status line: // https://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1 lines.push(`${protocol ? protocol.toUpperCase() + " " : ""}${this.statusCode} ${this.statusText}`); } for (let key in this.responseHeaders) lines.push(`${key}: ${this.responseHeaders[key]}`); return lines.join("\n") + "\n"; } ```
Karl Dubost
Comment 3 2024-10-14 23:57:05 PDT
Hmmm now I'm hesitating, should it be a bug report on Firefox devtools. :) (thinking)
Karl Dubost
Comment 4 2024-10-15 00:06:08 PDT
asking around to see if anybody has a strong opinion about it https://mastodon.cloud/@karlcow/113310156540445849
lola odelola
Comment 5 2024-12-05 12:24:16 PST
It seems that this bug was confirmed as a Firefox DevTools bug (https://bugzilla.mozilla.org/show_bug.cgi?id=1924705), should it be closed?
Karl Dubost
Comment 6 2024-12-05 17:21:01 PST
Yes good catch. Thanks Lola.
Note You need to log in before you can comment on or make changes to this bug.