anmonteiro / anmonteiro/piaf

`follow_redirect` don't work for some cases

Offen
#226 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
OCaml
Sterne
217
Forks
26
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Currently piaf doesn't follow redirects in certain cases.

There is some leeway in how percentage encoding is used in uri's, so multiple strings can represent the same uri.
Unfortunately, some providers block redirects if the url if it differs at all in its string representation to the response Location header . This means a uri encode/decode round trip can cause 403's.
Piaf should ensure the exact location string is used.

For example if the response location is:
```
Location: https://foo.com?k=v%3D
```
the Uri library will reencode the new request as:
```
https://foo.com?k=v=
```
which while technically the same url, it might get rejected.

Also it doesn't seem to update the host header in the request if it's a different host. This also can cause failures.

I will look into fixing these issues, but wanted to raise it first in case maintainers had any insight.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start by locating the follow_redirect implementation and tracing how the response Location value passes through the Uri library into the next request. Verify redirects preserve the exact Location string and update the Host header when the destination host changes; done means both cases work without regressions in the existing test suite.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
ocaml
Bereich
networking
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
55/100

Neue Issues direkt in Ihr Postfach

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