![告诉 cUrl 不要规范化 URL](https://linux22.com/image/1480215/%E5%91%8A%E8%AF%89%20cUrl%20%E4%B8%8D%E8%A6%81%E8%A7%84%E8%8C%83%E5%8C%96%20URL.png)
使用 curl 调用某个 URL 时,它会简化 URL 中的路径(例如 from /a/../b
to /b
)。我该如何告诉 cUrl 不要这样做?
$ curl -V
curl 7.35.0 (x86_64-pc-linux-gnu) libcurl/7.35.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP
$ curl -v 'localhost/a/../b'
* Rebuilt URL to: localhost/b
答案1
传递--path-as-is
标志:
$ curl --path-as-is 'http://localhost/a/../b'