Prevent curl from removing "../" from queried URL?

0

Prevent wget or curl from removing "../" from queried URL?

The following wget query using ../ to directory traverse:

wget http://192.168.0.24:7002/../../../../../mydir/myfile.txt

results in the effective query with ../ removed from the URL:

--2018-08-16 10:22:53--  http://192.168.0.24:7002/mydir/myfile.txt
Connecting to 192.168.0.24:7002... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

How can I force wget (or curl) to keep the original URL verbatim?

Shuzheng

Posted 2018-08-16T08:28:26.747

Reputation: 369

Answers

2

For curl try

 curl --path-as-is

--path-as-is

Tell curl to not handle sequences of /../ or /./ in the given URL path. Normally curl will squash or merge them according to standards but with this option set you tell it not to do that.

Added in 7.42.0.

See RFC 3986

RedGrittyBrick

Posted 2018-08-16T08:28:26.747

Reputation: 70 632