Skip to content

Commit 7663a48

Browse files
committed
set maximum redirect limit to what curl seems to use by default
1 parent 1bc42e9 commit 7663a48

File tree

1 file changed

+9
-1
lines changed
  • gix-transport/src/client/blocking_io/http/reqwest

1 file changed

+9
-1
lines changed

gix-transport/src/client/blocking_io/http/reqwest/remote.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,15 @@ impl Default for Remote {
6161
// git does not want to be redirected to a different host.
6262
attempt.stop()
6363
}
64-
_ => attempt.follow(),
64+
_ => {
65+
// emulate default git behaviour which relies on curl default behaviour apparently.
66+
const CURL_DEFAULT_REDIRS: usize = 50;
67+
if prev_urls.len() >= CURL_DEFAULT_REDIRS {
68+
attempt.error("too many redirects")
69+
} else {
70+
attempt.follow()
71+
}
72+
}
6573
}
6674
} else {
6775
attempt.stop()

0 commit comments

Comments
 (0)