CURLOPT_CURLU(3)

CURLOPT_CURLU3

Url in url handle format

Usage

#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CURLU, CURLU *pointer);

Overview

Pass in a pointer to the URL handle to work with. The parameter should be a CURLU pointer. Setting CURLOPT_CURLU(3) explicitly overrides CURLOPT_URL(3).

CURLOPT_URL(3) or CURLOPT_CURLU(3) must be set before a transfer is started.

libcurl uses this handle and its contents read-only and does not change its contents. An application can update the contents of the URL handle after a transfer is done and if the same handle is used in a subsequent request the updated contents is used.

Default

NULL

Protocols

This functionality affects all supported protocols

Examples

int main(void)
{
  CURL *curl = curl_easy_init();
  CURLU *urlp = curl_url();
  if(curl) {
    CURLcode result;
    CURLUcode ret;
    ret = curl_url_set(urlp, CURLUPART_URL, "https://example.com", 0);
    curl_easy_setopt(curl, CURLOPT_CURLU, urlp);
    result = curl_easy_perform(curl);
    curl_url_cleanup(urlp);
    curl_easy_cleanup(curl);
  }
}

Return value

curl_easy_setopt(3) returns a CURLcode indicating success or error.

CURLE_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors(3).

Releases

5 releases since Debian 10 (Buster); the text changed 4 times.

  1. 10
  2. 11
  3. 12
  4. 13
  5. Arch

Availability

Added in curl 7.63.0

From curl 8.23.0-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.