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

-w '%{redirect_url}' doesn't work with -L #1489

Closed
LLFourn opened this Issue May 17, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@LLFourn

LLFourn commented May 17, 2017

I did this

curl -L --max-redir 0 -w  '%{url_effective}\n%{redirect_url}\n' -s -o /dev/null 'https://httpbin.org/redirect/1'

and

curl -w  '%{url_effective}\n%{redirect_url}\n' -s -o /dev/null 'https://httpbin.org/redirect/1'

I expected the following

Them to be the same. Although the documentation does mention it doesn't work with -L, if curl stops following redirects because it hits --max-redir it makes sense to me that the final redirect response should put its url in %{redirect_url}

(I guess this might be feature request?)

curl/libcurl version

curl 7.54.0 (x86_64-apple-darwin16.5.0) libcurl/7.54.0 SecureTransport zlib/1.2.8
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: IPv6 Largefile NTLM NTLM_WB SSL libz UnixSockets 

operating system

OS X

Thanks

@bagder bagder added the enhancement label May 18, 2017

bagder added a commit that referenced this issue May 18, 2017

redirect: store the "would redirect to" URL when max redirs is reached
Test 1261 added to verify.

Reported-by: Lloyd Fournier

Fixes #1489

bagder added a commit that referenced this issue May 23, 2017

redirect: store the "would redirect to" URL when max redirs is reached
Test 1261 added to verify.

Reported-by: Lloyd Fournier

Fixes #1489

@bagder bagder closed this in bba5907 May 23, 2017

@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.