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