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