1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_CURLU 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_URL (3) 9 - curl_url (3) 10 - curl_url_cleanup (3) 11 - curl_url_dup (3) 12 - curl_url_get (3) 13 - curl_url_set (3) 14 - curl_url_strerror (3) 15Protocol: 16 - All 17Added-in: 7.63.0 18--- 19 20# NAME 21 22CURLOPT_CURLU - URL in URL handle format 23 24# SYNOPSIS 25 26~~~c 27#include <curl/curl.h> 28 29CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CURLU, CURLU *pointer); 30~~~ 31 32# DESCRIPTION 33 34Pass in a pointer to the *URL* handle to work with. The parameter should be a 35*CURLU pointer*. Setting CURLOPT_CURLU(3) explicitly overrides 36CURLOPT_URL(3). 37 38CURLOPT_URL(3) or CURLOPT_CURLU(3) **must** be set before a 39transfer is started. 40 41libcurl uses this handle and its contents read-only and does not change its 42contents. An application can update the contents of the URL handle after a 43transfer is done and if the same handle is used in a subsequent request the 44updated contents is used. 45 46# DEFAULT 47 48NULL 49 50# %PROTOCOLS% 51 52# EXAMPLE 53 54~~~c 55int main(void) 56{ 57 CURL *curl = curl_easy_init(); 58 CURLU *urlp = curl_url(); 59 if(curl) { 60 CURLcode res; 61 CURLUcode ret; 62 ret = curl_url_set(urlp, CURLUPART_URL, "https://example.com", 0); 63 64 curl_easy_setopt(curl, CURLOPT_CURLU, urlp); 65 66 res = curl_easy_perform(curl); 67 68 curl_url_cleanup(urlp); 69 curl_easy_cleanup(curl); 70 } 71} 72~~~ 73 74# %AVAILABILITY% 75 76# RETURN VALUE 77 78Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 79