anmonteiro / anmonteiro/piaf

`follow_redirect` don't work for some cases

Aperta
#226 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
OCaml
Stelle
217
Fork
26
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
ocaml
Ambito
networking
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.