1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_REQUEST_TARGET 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_CUSTOMREQUEST (3) 9 - CURLOPT_HTTPGET (3) 10 - CURLOPT_PATH_AS_IS (3) 11 - CURLOPT_URL (3) 12--- 13 14# NAME 15 16CURLOPT_REQUEST_TARGET - alternative target for this request 17 18# SYNOPSIS 19 20~~~c 21#include <curl/curl.h> 22 23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_REQUEST_TARGET, string); 24~~~ 25 26# DESCRIPTION 27 28Pass a char pointer to string which libcurl uses in the upcoming request 29instead of the path as extracted from the URL. 30 31libcurl passes on the verbatim string in its request without any filter or 32other safe guards. That includes white space and control characters. 33 34# DEFAULT 35 36NULL 37 38# PROTOCOLS 39 40HTTP 41 42# EXAMPLE 43 44~~~c 45int main(void) 46{ 47 CURL *curl = curl_easy_init(); 48 if(curl) { 49 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/*"); 50 curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "OPTIONS"); 51 52 /* issue an OPTIONS * request (no leading slash) */ 53 curl_easy_setopt(curl, CURLOPT_REQUEST_TARGET, "*"); 54 55 /* Perform the request */ 56 curl_easy_perform(curl); 57 } 58} 59~~~ 60 61# AVAILABILITY 62 63Added in 7.55.0 64 65# RETURN VALUE 66 67Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 68