1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_PATH_AS_IS
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_DEBUGFUNCTION (3)
9  - CURLOPT_STDERR (3)
10  - CURLOPT_URL (3)
11  - curl_url_set (3)
12Protocol:
13  - All
14---
15
16# NAME
17
18CURLOPT_PATH_AS_IS - do not handle dot dot sequences
19
20# SYNOPSIS
21
22~~~c
23#include <curl/curl.h>
24
25CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PATH_AS_IS, long leaveit);
26~~~
27
28# DESCRIPTION
29
30Set the long *leaveit* to 1, to explicitly tell libcurl to not alter the
31given path before passing it on to the server.
32
33This instructs libcurl to NOT squash sequences of "/../" or "/./" that may
34exist in the URL's path part and that is supposed to be removed according to
35RFC 3986 section 5.2.4.
36
37Some server implementations are known to (erroneously) require the dot dot
38sequences to remain in the path and some clients want to pass these on in
39order to try out server implementations.
40
41By default libcurl normalizes such sequences before using the path.
42
43The corresponding flag for the curl_url_set(3) function is called
44**CURLU_PATH_AS_IS**.
45
46# DEFAULT
47
480
49
50# EXAMPLE
51
52~~~c
53int main(void)
54{
55  CURL *curl = curl_easy_init();
56  if(curl) {
57    curl_easy_setopt(curl, CURLOPT_URL,
58                     "https://example.com/../../etc/password");
59
60    curl_easy_setopt(curl, CURLOPT_PATH_AS_IS, 1L);
61
62    curl_easy_perform(curl);
63  }
64}
65~~~
66
67# AVAILABILITY
68
69Added in 7.42.0
70
71# RETURN VALUE
72
73Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
74