xref: /curl/docs/libcurl/opts/CURLOPT_CURLU.md (revision e3fe0200)
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
17---
18
19# NAME
20
21CURLOPT_CURLU - URL in URL handle format
22
23# SYNOPSIS
24
25~~~c
26#include <curl/curl.h>
27
28CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CURLU, CURLU *pointer);
29~~~
30
31# DESCRIPTION
32
33Pass in a pointer to the *URL* handle to work with. The parameter should be a
34*CURLU pointer*. Setting CURLOPT_CURLU(3) explicitly overrides
35CURLOPT_URL(3).
36
37CURLOPT_URL(3) or CURLOPT_CURLU(3) **must** be set before a
38transfer is started.
39
40libcurl uses this handle and its contents read-only and does not change its
41contents. An application can update the contents of the URL handle after a
42transfer is done and if the same handle is used in a subsequent request the
43updated contents is used.
44
45# DEFAULT
46
47The default value of this parameter is NULL.
48
49# EXAMPLE
50
51~~~c
52int main(void)
53{
54  CURL *curl = curl_easy_init();
55  CURLU *urlp = curl_url();
56  if(curl) {
57    CURLcode res;
58    CURLUcode ret;
59    ret = curl_url_set(urlp, CURLUPART_URL, "https://example.com", 0);
60
61    curl_easy_setopt(curl, CURLOPT_CURLU, urlp);
62
63    res = curl_easy_perform(curl);
64
65    curl_url_cleanup(urlp);
66    curl_easy_cleanup(curl);
67  }
68}
69~~~
70
71# AVAILABILITY
72
73Added in 7.63.0.
74
75# RETURN VALUE
76
77Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
78