-
-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parameter --max-redirects
did not take effect
#715
Comments
I don't think this is lychee's issue. You can also try this with curl
|
But in fact, this URL does not time out, lychee still gives an error result, you can click on it to see. I think the root cause may be: the actual URL is only redirected 7 times, but for some reason in lychee redirected so many times that it either exceeds the set |
How do you know this? |
There are definitely more than 30 redirects. I've managed to get TIMEOUT with 100 redirects and firefox's user-agent
|
It turns out that if you don't provide a user-agent it returns too many redirects error. With user-agent it times out. |
linkchecker told me that:
Then return 200 linkchecker's user-agent is |
Very weird, I get the same error.
I don't know what could be causing this. If someone wants to experiment with it, feel free to add some logs/printlns or step through it with a debugger to find the root cause. |
I've no idea why browsers are able to get correct http response, but not curl of lychee. |
Apparently it works for linkchecker, though, and that's also a cli tool? 🤔 |
Differences I could see for linkchecker:
I tried to emulate this behavior with curl... curl --location-trusted -c cookie-jar.txt --max-redirs 0 -L --referer ';auto' -A 'Mozilla
/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36' 'h
ttps://account.microsoft.com/family' ... but I run into a timeout without any output. (The |
It works with cookie support; no user agent needed. This is the output with #1146:
If you want to test it, you have to compile lychee from this branch until the changes get released. |
As a side note, cookies are also why it works in linkchecker. |
This is a very conservative and limited implementation of cookie support. The goal is to ship an MVP, which covers 80% of the use-cases. When you run lychee with --cookie-jar cookies.json, all cookies will be stored in cookies.json, one cookie per line. This makes cookies easy to edit by hand if needed, although this is an advanced use-case and the API for the format is not guaranteed to be stable. Fixes: #645, #715 Partially fixes: #1108
I set
--max-redirects
is 30 and tested a 7 redirects example lychee reports too many redirects.My CMD is:
lychee /path/to/links.html --max-redirects 30 --format detailed
The result is:
links.html
content is:<a href="https://account.microsoft.com/family"></a>
The text was updated successfully, but these errors were encountered: