Http: a bodyless GET is sent with Content-Type: text/plain, and with no User-Agent (GitHub's API answers 403)
Maintainer antworten meist innerhalb von 1 Tag
Ein zugehöriger Pull Request wurde bereits gemerged.
- #534 von @lukewilliamboswell — gemerged
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 57/100
Rechercherichtung
Start by locating Http.send! and send_streaming!, then trace how they add default headers when building a request. Check the HTTP tests for bodyless GET requests and requests with a caller supplied User-Agent. Done means the defaults match the intended behavior for both cases, with tests covering each.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Two default headers surprised me while porting a tool to 0.26.0-rc3:
1. A bodyless GET is sent with Content-Type: text/plain. send_streaming! adds Content-Type: text/plain to any request that does not set one, even when there is no body. What Http.send! sends for Request.from_method(GET).with_uri("http://127.0.0.1:18099/x"), captured with nc -l -p 18099:
GET /x HTTP/1.1
content-type: text/plain
host: 127.0.0.1:18099
A Content-Type describes content, and this request has none. Servers mostly ignore it, but a strict one can refuse it, and it is a header the caller never asked for. Suggestion: add the default only when the body is not empty, or not at all.
2. No User-Agent. GitHub's REST API refuses requests without one:
api = Http.send!(Request.from_method(GET).with_uri("https://api.github.com/repos/roc-lang/basic-cli/branches/main"), {})?
# Response.status(api) == 403
With .add_header("User-Agent", "something") it answers 200. curl, Go's net/http and Python's urllib each send one by default. GitHub is probably the most common API a CLI script talks to, and a 403 with a body about a missing User-Agent is easy to miss. Suggestion: a default such as roc-basic-cli/0.26, replaced by any User-Agent the request sets. Or a line in Http's docs, if a default is not wanted.
Seen on 0.26.0-rc3, Roc nightly-2026-10-17-5f126ac and -10-19, Linux x86_64. Thank you for rc3: details on how it went for us are in #529.
- Vorherrschende Sprache
- Rust
- Sterne
- 122
- Forks
- 47
- Ø Merge
- 11 Std. 6 Min.
- Gemergte PRs (30 T.)
- 21
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus roc-lang/basic-cli
-
Unix socket supportOffen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
roc-lang/basic-cli#500 · 1 Kommentar · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
roc-lang/basic-cli#482 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 45/100
roc-lang/basic-cli#455 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 32/100
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in roc-lang/basic-cli
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
peteonrails/voxtype#909 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 69/100
alchemyplatform/rundler#1358 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
[BUG] VA-API HEVC: out-of-range cu_qp_delta (measured -130..+56) produces a corrupted bitstreamOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
selkies-project/pixelflux#52 · 4 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
llm translation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
BerriAI/litellm#47884 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
area:testing bug good first issue platform:windows priority:medium
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
rtk-ai/rtk#4728 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag