Telling cUrl not to normalize a url

12

1

When using curl to call some url, it simplifies the path in the url (for example from /a/../b to /b). How can I tell cUrl not to do so?

$ 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

estani

Posted 2016-01-12T16:04:29.577

Reputation: 546

Answers

15

Pass the --path-as-is flag:

$ curl --path-as-is 'http://localhost/a/../b'

rightfold

Posted 2016-01-12T16:04:29.577

Reputation: 579

2curl: option --path-as-is: is unknown - curl 7.35.0, do you know which curl version added this? – estani – 2016-04-22T08:47:37.550

@estani according to the man page: "Aded (sic) in 7.42.0" – rightfold – 2016-04-22T09:59:29.990

At least now a days none uses such an older version anymore, so the answer is for all purposes right – estani – 2019-08-13T12:37:54.637