Artifactspublic-v0

curl

master
ply4 git calls1.0 s288 KiB2 cachedprotocol v2
98 lines2.6 KiBRaw

NAME

CURLOPT_USERPWD - username and password to use in authentication

SYNOPSIS

c
#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_USERPWD, char *userpwd);

DESCRIPTION

Pass a char pointer as parameter, pointing to a null-terminated login details string for the connection. The format of which is: [username]:[password].

When using Kerberos V5 authentication with a Windows based server, you should specify the username part with the domain name in order for the server to successfully obtain a Kerberos Ticket. If you do not then the initial part of the authentication handshake may fail.

To specify the domain name use either Down-Level Logon Name or UPN (User Principal Name) formats. For example EXAMPLE\user and user@example.com respectively.

Some HTTP servers (on Windows) support inclusion of the domain for Basic authentication as well.

When using HTTP and CURLOPT_FOLLOWLOCATION(3), libcurl might perform several requests to possibly different hosts. libcurl only sends this user and password information to hosts using the initial hostname (unless CURLOPT_UNRESTRICTED_AUTH(3) is set), so if libcurl follows redirects to other hosts, it does not send the user and password to those. This is enforced to prevent accidental information leakage.

Use CURLOPT_HTTPAUTH(3) to specify the authentication method for HTTP based connections or CURLOPT_LOGIN_OPTIONS(3) to control IMAP, POP3 and SMTP options.

The user and password strings are not URL decoded, so there is no way to send in a username containing a colon using this option. Use CURLOPT_USERNAME(3) for that, or include it in the URL.

The application does not have to keep the string around after setting this option.

Using this option multiple times makes the last set string override the previous ones. Set it to NULL to disable its use again.

DEFAULT

NULL

%PROTOCOLS%

EXAMPLE

c
int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");

    curl_easy_setopt(curl, CURLOPT_USERPWD, "clark:kent");

    result = curl_easy_perform(curl);

    curl_easy_cleanup(curl);
  }
}

%AVAILABILITY%

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).

1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_USERPWD
5Section: 3
6Source: libcurl
7See-also:
8 - CURLOPT_PASSWORD (3)
9 - CURLOPT_PROXYUSERPWD (3)
10 - CURLOPT_USERNAME (3)
11Protocol:
12 - All
13Added-in: 7.1
14---
16# NAME
18CURLOPT_USERPWD - username and password to use in authentication
20# SYNOPSIS
22~~~c
23#include <curl/curl.h>
25CURLcode curl_easy_setopt(CURL *handle, CURLOPT_USERPWD, char *userpwd);
26~~~
28# DESCRIPTION
30Pass a char pointer as parameter, pointing to a null-terminated login details
31string for the connection. The format of which is: [username]:[password].
33When using Kerberos V5 authentication with a Windows based server, you should
34specify the username part with the domain name in order for the server to
35successfully obtain a Kerberos Ticket. If you do not then the initial part of
36the authentication handshake may fail.
38To specify the domain name use either Down-Level Logon Name or UPN (User
39Principal Name) formats. For example **EXAMPLE\user** and **user@example.com**
40respectively.
42Some HTTP servers (on Windows) support inclusion of the domain for Basic
43authentication as well.
45When using HTTP and CURLOPT_FOLLOWLOCATION(3), libcurl might perform several
46requests to possibly different hosts. libcurl only sends this user and
47password information to hosts using the initial hostname (unless
48CURLOPT_UNRESTRICTED_AUTH(3) is set), so if libcurl follows redirects to other
49hosts, it does not send the user and password to those. This is enforced to
50prevent accidental information leakage.
52Use CURLOPT_HTTPAUTH(3) to specify the authentication method for HTTP
53based connections or CURLOPT_LOGIN_OPTIONS(3) to control IMAP, POP3 and
54SMTP options.
56The user and password strings are not URL decoded, so there is no way to send
57in a username containing a colon using this option. Use CURLOPT_USERNAME(3)
58for that, or include it in the URL.
60The application does not have to keep the string around after setting this
61option.
63Using this option multiple times makes the last set string override the
64previous ones. Set it to NULL to disable its use again.
66# DEFAULT
68NULL
70# %PROTOCOLS%
72# EXAMPLE
74~~~c
75int main(void)
77 CURL *curl = curl_easy_init();
78 if(curl) {
79 CURLcode result;
80 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
82 curl_easy_setopt(curl, CURLOPT_USERPWD, "clark:kent");
84 result = curl_easy_perform(curl);
86 curl_easy_cleanup(curl);
87 }
89~~~
91# %AVAILABILITY%
93# RETURN VALUE
95curl_easy_setopt(3) returns a CURLcode indicating success or error.
97CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
98libcurl-errors(3).
Diagnostics4 git calls · 1.0 s
CallStatusSizeTime01.0 s
discover200152 B2 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
git.response.bytes=152
git.server.agent=gitty/1.0
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch object-format
git.server.fetch=shallow filter sideband-all
git.protocol.version=2
git.pkt.frames=8
git.pkt.data=6
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=152
git.pkt.payload.max=34
ls-refs200149 B · hit2 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=2
git.response.bytes=149
git.response.cache=HIT
git.response.duration_ms=2
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=149
git.pkt.payload.max=78
git.ls_refs.count=2
git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=1035
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=blob:none
git.fetch.filter.requested=tree:0
git.fetch.filter.fallback=blob:none
git.fetch.filter.learned=false
git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=10
git.pkt.data=8
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=293470
git.pkt.payload.max=65516
git.sideband.band1.bytes=293354
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=87
git.pack.bytes=293354
git.pack.ofs_delta=0
git.pack.ref_delta=1
git.pack.chain.max=1
git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0
git.pack.full=86
Open pack map
fetch2001.4 KiB1.0 s
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=1452
git.response.cache=MISS
git.response.duration_ms=1035
git.fetch.wants=da87415bfa3a253663b41df75d56cb632d78493d
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=1452
git.pkt.payload.max=1431
git.sideband.band1.bytes=1430
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
Ref
refs/heads/master
Commit
31c911efe5652725e930f4d2e60c9060e5f6646d
cf-ray
a5e321efec345aae
Request
6bb8a25c…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format