Skip to content

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

@LLFourn

Description

@LLFourn

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions