CURLOPT_PATH_AS_IS(3)
π CURLOPT_PATH_AS_IS β the "leave my dots alone" era
ok so this one lives in the libcurl library functions manual, and bestie, it's literally about telling curl to NOT touch your dot-dot sequences. groundbreaking, i know. let's get into it π
β¨ NAME β¨
CURLOPT_PATH_AS_IS β do not handle dot-dot sequences
no cap, that's the whole vibe: hands off the .. π«Ά
πΈ SYNOPSIS πΈ
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PATH_AS_IS, long leaveit);
π¦ DESCRIPTION π¦
okay so here's the tea β β you set the long leaveit to 1, and that's you explicitly telling libcurl to not alter the given path before passing it on to the server. like, respectfully, don't edit my URL π
This instructs libcurl to NOT squash sequences of "/../" or "/./" that may exist in the URL's path part and that is supposed to be removed according to RFC 3986 section 5.2.4. yes, the RFC said so, and we're ignoring it on purpose. main character energy fr fr.
Some server implementations are known to (erroneously) require the dot-dot sequences to remain in the path, and some clients want to pass these on in order to try out server implementations. so like, sometimes the "wrong" thing is the thing that works π iconic honestly.
By default libcurl normalizes such sequences before using the path. that's the normal behavior, no notes.
β οΈ heads up bestie: this is a request for the first request libcurl issues. when following redirects, it may no longer apply. so don't come for me when the redirect does its own thing π
The corresponding flag for the curl_url_set(3) function is called CURLU_PATH_AS_IS. sibling energy π
π DEFAULT π
0
(yeah, off by default β curl's out here being polite unless you say otherwise)
π PROTOCOLS π
This functionality affects all supported protocols. all of them. every single one. we love an inclusive queen π
π₯ EXAMPLE π₯
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL,
"https://example.com/../../etc/password");
curl_easy_setopt(curl, CURLOPT_PATH_AS_IS, 1L);
curl_easy_perform(curl);
}
}
look at that path just... existing. unbothered. unnormalized. slay β¨
β AVAILABILITY β
Added in curl 7.42.0 β a certified classic at this point π
π RETURN VALUE π
curl_easy_setopt(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors(3).
so like, 0 = we ate, non-zero = something went sideways, go read the errors page π«Ά
π SEE ALSO π
and that's the whole page bestie, no crumbs left π
this lil beauty is from the libcurl Library Functions Manual, dated 2026-10-12 β go forth and keep those dots exactly where you found them π¦β¨
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms