Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

HTTP/2 headers should not be included in snippets

Offen
#298 0 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
typescript
Bereich
tooling

Rechercherichtung

Beginne damit nachzuverfolgen, wie HAR-Daten in Request-Header geladen werden und wie diese Header an Snippet-Generatoren übergeben werden. Reproduziere die beispielhafte HTTP/2-HAR-Eingabe und vergleiche die erzeugte curl-Ausgabe. Überprüfe anschließend, dass Pseudo-Header wie :authority und :method ausgeschlossen werden, ohne gewöhnliche Header zu entfernen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

It doesn't seem to be explicitly specified anywhere, but when exporting a HAR file for HTTP/2 traffic, it seems that most clients (e.g. Chrome) do include the HTTP/2 pseudo-headers in the header data. These are headers like :authority and :method.

This makes sense for HAR files, when you want an accurate recording of the full traffic details, but these shouldn't be included in HTTP snippets imo. Most clients will reject them completely, for example this curl command generated by httpsnippet will always fail, even though the original request worked fine:

curl --request GET \
  --url https://google.com/ \
  --header ':authority: google.com' \
  --header ':method: GET' \
  --header ':path: /' \
  --header ':scheme: https' \
  --header 'accept: */*' \
  --header 'user-agent: curl/7.68.0'

These headers are basically duplicating the method & URL parts, which we include separately anyway. They're just a detail of how the method & URL are sent in HTTP/2. They also won't work because I think in every snippet here we're sending pure HTTP/1 requests, where these are generally illegal header names anyway (which I guess is why curl fails here).

I would suggest we filter these out, i.e. drop all headers starting with : when we load data from the HAR. That will never happen in HTTP/1 traffic, and in HTTP/2 traffic it's almost always redundant, and the rare cases where it's not are very weird (I think sending a request to one domain but with a :authority header for different domain is the only possible example?).

Alternatively, we could try to fully translate HTTP/2 data back into the exactly equivalent HTTP/1 requests. I wrote a blog post about that a while back here: https://httptoolkit.tech/blog/translating-http-2-into-http-1/#translating-one-to-the-other. That would just be the first HTTP/2 -> HTTP/1 list, under 'Translating one to the other', and only half are relevant, so I think it's relatively simple, but it's still more complicated than just dropping the headers, and it might plausibly have other side effects.

What do you think?

Vorherrschende Sprache
TypeScript
Sterne
1.2k
Forks
241
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus Kong/httpsnippet

Alle Issues in Kong/httpsnippet

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.