|P is for Practical|
Thanks for your reply,
I can confirm that by just setting ONLY requests_redirectable => , LWP::UserAgent does not follow redirects and does not warn about a loop detected.
So, I guess you are asking me to write a documentation patch where to say:
"If you do not want LWP::UserAgent to follow redirects for a certain request then prepare a new array with only the request names you wish redirects to be followed and insert it via requests_redirectable => $array_of_requests_to_follow_redirect . If you do not want LWP::UserAgent to follow ANY request then set this to an empty array ref."
That's no problem, I can do that.
As a side remark (but quite important imo):
when looking at the code of LWP::UserAgent at the place where it gives the loop warning (just search for 'loop') one can see that when the alleged loop is detected, the warning is inserted in the headers AND the sub returns immediately thus omitting code for running the handlers or normalising (absolutising) the Location url from the returned headers and lots of other stuff.
So that "warning" is not that innocent and people should care about it. Maybe it should be clarified. I will agree with the "Anonymous Monk" (Mar 13, 2018 at 20:21 UTC) who considers this as a bug because the logic (with my limited understanding of that code) should be to make a request, increment the redirect count (its name probably is confusing because there is no redirect yet but just one - and maybe the only - request) and then check if that count exceeds the max_redirect limit (and not check if it is equal to it too).
In view of the above, a second documentation patch could go like this:
"Redirect loop detection is a bit petulant and one should not upset it further by demanding zero max_redirect. Notice that max_redirect counts the first request as a redirect. And so if one wants zero redirects, one should set max_redirect to 1 really. The side-effect of LWP::UserAgent detecting a loop and acting on it, appart from inserting a Client-Warning in the response headers, is that the request() will immediately return albeit half-finished. For example no handlers will be run."
In reply to Re^2: LWP::UserAgent : setting max_redirect to 0 yields 'Client-Warning: Redirect loop detected