GNURLOPT_PATH_AS_IS(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸ’… GNURLOPT_PATH_AS_IS(3) πŸ’…

okay so bestie, this page lives in the curl_easy_setopt options manual, and it's all about one very specific little switch: CURLOPT_PATH_AS_IS. stay with me, it's actually iconic.

✨ NAME ✨

CURLOPT_PATH_AS_IS β€” do not handle dot dot sequences

πŸ¦‹ SYNOPSIS πŸ¦‹

okay so the synopsis is literally:

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PATH_AS_IS, long
       leaveit);

πŸ’– DESCRIPTION πŸ’–

Set that long leaveit to 1, and you're explicitly telling libcurl to not alter the given path before passing it on to the server. like, hands off the path, okay?

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.

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. iykyk β€” this option is for exactly those situations.

By default libcurl will merge such sequences before using the path.

πŸŽ€ DEFAULT πŸŽ€

0

so if you do nothing, libcurl does its normal merge-y thing. no cap.

🌈 PROTOCOLS 🌈

All

every protocol, bestie ✨

πŸ“ EXAMPLE πŸ“

Here's the example, bestie β€” copy it exactly:

CURL *curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/../../etc/password");

  curl_easy_setopt(curl, CURLOPT_PATH_AS_IS, 1L);

  curl_easy_perform(curl);
}

⭐ AVAILABILITY ⭐

Added in 7.42.0. periodt.

πŸ’€ RETURN VALUE πŸ’€

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.

🫢 SEE ALSO 🫢

go read these too:


that's the whole page, bestie β€” signing off from libcurl 7.42.0, dated 17 Jun 2014, and this iconic page is GNURLOPT_PATH_AS_IS(3) πŸ’–βœ¨

πŸ“¦ where this page comes from