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