Bug 263931
| Summary: | Web Inspector: Change the format for Copy HTTP Response/Request headers | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Karl Dubost <karlcow> |
| Component: | Web Inspector | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED INVALID | ||
| Severity: | Normal | CC: | inspector-bugzilla-changes, lolaodelola, webkit-bug-importer |
| Priority: | P2 | Keywords: | GoodFirstBug, InRadar |
| Version: | Safari 17 | ||
| Hardware: | All | ||
| OS: | All | ||
Karl Dubost
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/117709244>
Karl Dubost
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
Hmmm now I'm hesitating, should it be a bug report on Firefox devtools. :)
(thinking)
Karl Dubost
asking around to see if anybody has a strong opinion about it
https://mastodon.cloud/@karlcow/113310156540445849
lola odelola
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
Yes good catch. Thanks Lola.