Artifactspublic-v0

curl

master
ply4 git calls145 ms289 KiB2 cachedprotocol v2
181 lines5.2 KiBRaw

NAME

CURLOPT_HTTPAUTH - HTTP server authentication methods to try

SYNOPSIS

c
#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPAUTH, long bitmask);

DESCRIPTION

Pass a long as parameter, which is set to a bitmask, to tell libcurl which authentication method(s) you want it to use speaking to the remote server.

The available bits are listed below. If more than one bit is set, libcurl first queries the host to see which authentication methods it supports and then picks the best one you allow it to use. For some methods, this induces an extra network round-trip. Set the actual name and password with the CURLOPT_USERPWD(3) option or with the CURLOPT_USERNAME(3) and the CURLOPT_PASSWORD(3) options.

Custom Authorization: headers set with CURLOPT_HTTPHEADER(3) may interfere with and cause unintended side-effects if combined with authentication set with CURLOPT_HTTPAUTH(3).

For authentication with a proxy, see CURLOPT_PROXYAUTH(3).

CURLAUTH_BASIC

HTTP Basic authentication. This is the default choice, and the only method that is in wide-spread use and supported virtually everywhere. This sends the username and password over the network in plain text, easily captured by others.

CURLAUTH_DIGEST

HTTP Digest authentication. Digest authentication is defined in RFC 2617 and is a more secure way to do authentication over public networks than the regular old-fashioned Basic method.

CURLAUTH_DIGEST_IE

The IE-specific Digest authentication behavior is no longer supported. This bit is kept for compatibility and is treated as CURLAUTH_DIGEST.

CURLAUTH_BEARER

HTTP Bearer token authentication, used primarily in OAuth 2.0 protocol.

You can set the Bearer token to use with CURLOPT_XOAUTH2_BEARER(3).

CURLAUTH_NEGOTIATE

HTTP Negotiate (SPNEGO) authentication. Negotiate authentication is defined in RFC 4559 and is the most secure way to perform authentication over HTTP.

You need to build libcurl with a suitable GSS-API library or SSPI on Windows for this to work.

CURLAUTH_NTLM

libcurl no longer supports this option since 8.23.0.

HTTP NTLM authentication. A proprietary protocol invented and used by Microsoft. It uses a challenge-response and hash concept similar to Digest, to prevent the password from being eavesdropped.

NTLM uses weak cryptographic algorithms and is not considered secure.

CURLAUTH_NTLM_WB

Support for this is removed since libcurl 8.8.0.

NTLM delegating to winbind helper. Authentication is performed by a separate binary application that is executed when needed. The name of the application is specified at compile time but is typically /usr/bin/ntlm_auth.

Note that libcurl forks when necessary to run the winbind application and kill it when complete, calling waitpid() to await its exit when done. On POSIX operating systems, killing the process causes a SIGCHLD signal to be raised (regardless of whether CURLOPT_NOSIGNAL(3) is set), which must be handled intelligently by the application. In particular, the application must not unconditionally call wait() in its SIGCHLD signal handler to avoid being subject to a race condition. This behavior is subject to change in future versions of libcurl.

CURLAUTH_ANY

This is a convenience macro that sets all bits and thus makes libcurl pick any it finds suitable. libcurl automatically selects the one it finds most secure.

CURLAUTH_ANYSAFE

This is a convenience macro that sets all bits except Basic and thus makes libcurl pick any it finds suitable. libcurl automatically selects the one it finds most secure.

CURLAUTH_ONLY

This is a meta symbol. OR this value together with a single specific auth value to force libcurl to probe for unrestricted auth and if not, only that single auth algorithm is acceptable.

CURLAUTH_AWS_SIGV4

provides AWS V4 signature authentication on HTTPS header see CURLOPT_AWS_SIGV4(3).

CURLAUTH_HTTPSIG

provides RFC 9421 HTTP Message Signatures on outgoing requests, see CURLOPT_HTTPSIG_ALGORITHM(3).

DEFAULT

CURLAUTH_BASIC

%PROTOCOLS%

EXAMPLE

c
int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
    /* allow whatever auth the server speaks */
    curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
    curl_easy_setopt(curl, CURLOPT_USERPWD, "james:bond");
    result = curl_easy_perform(curl);
  }
}

HISTORY

CURLAUTH_DIGEST_IE was added in 7.19.3

CURLAUTH_ONLY was added in 7.21.3

CURLAUTH_NTLM_WB was added in 7.22.0

CURLAUTH_* macros became long types in 7.26.0, prior to this version a long cast was necessary when passed to curl_easy_setopt(3).

CURLAUTH_BEARER was added in 7.61.0

CURLAUTH_AWS_SIGV4 was added in 7.74.0

CURLAUTH_DIGEST_IE does nothing since 8.21.0

CURLAUTH_HTTPSIG was added in 8.22.0

%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_HTTPAUTH
5Section: 3
6Source: libcurl
7Protocol:
8 - HTTP
9See-also:
10 - CURLOPT_PASSWORD (3)
11 - CURLOPT_PROXYAUTH (3)
12 - CURLOPT_USERNAME (3)
13Added-in: 7.10.6
14---
16# NAME
18CURLOPT_HTTPAUTH - HTTP server authentication methods to try
20# SYNOPSIS
22~~~c
23#include <curl/curl.h>
25CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPAUTH, long bitmask);
26~~~
28# DESCRIPTION
30Pass a long as parameter, which is set to a bitmask, to tell libcurl which
31authentication method(s) you want it to use speaking to the remote server.
33The available bits are listed below. If more than one bit is set, libcurl
34first queries the host to see which authentication methods it supports and
35then picks the best one you allow it to use. For some methods, this induces an
36extra network round-trip. Set the actual name and password with the
37CURLOPT_USERPWD(3) option or with the CURLOPT_USERNAME(3) and the
38CURLOPT_PASSWORD(3) options.
40Custom `Authorization:` headers set with CURLOPT_HTTPHEADER(3) may interfere
41with and cause unintended side-effects if combined with authentication set
42with CURLOPT_HTTPAUTH(3).
44For authentication with a proxy, see CURLOPT_PROXYAUTH(3).
46## CURLAUTH_BASIC
48HTTP Basic authentication. This is the default choice, and the only method
49that is in wide-spread use and supported virtually everywhere. This sends
50the username and password over the network in plain text, easily captured by
51others.
53## CURLAUTH_DIGEST
55HTTP Digest authentication. Digest authentication is defined in RFC 2617 and
56is a more secure way to do authentication over public networks than the
57regular old-fashioned Basic method.
59## CURLAUTH_DIGEST_IE
61The IE-specific Digest authentication behavior is no longer supported.
62This bit is kept for compatibility and is treated as CURLAUTH_DIGEST.
64## CURLAUTH_BEARER
66HTTP Bearer token authentication, used primarily in OAuth 2.0 protocol.
68You can set the Bearer token to use with CURLOPT_XOAUTH2_BEARER(3).
70## CURLAUTH_NEGOTIATE
72HTTP Negotiate (SPNEGO) authentication. Negotiate authentication is defined
73in RFC 4559 and is the most secure way to perform authentication over HTTP.
75You need to build libcurl with a suitable GSS-API library or SSPI on Windows
76for this to work.
78## CURLAUTH_NTLM
80libcurl no longer supports this option since 8.23.0.
82HTTP NTLM authentication. A proprietary protocol invented and used by
83Microsoft. It uses a challenge-response and hash concept similar to Digest, to
84prevent the password from being eavesdropped.
86NTLM uses weak cryptographic algorithms and is not considered secure.
88## CURLAUTH_NTLM_WB
90Support for this is removed since libcurl 8.8.0.
92NTLM delegating to winbind helper. Authentication is performed by a separate
93binary application that is executed when needed. The name of the application
94is specified at compile time but is typically **/usr/bin/ntlm_auth**.
96Note that libcurl forks when necessary to run the winbind application and kill
97it when complete, calling **waitpid()** to await its exit when done. On POSIX
98operating systems, killing the process causes a SIGCHLD signal to be raised
99(regardless of whether CURLOPT_NOSIGNAL(3) is set), which must be handled
100intelligently by the application. In particular, the application must not
101unconditionally call wait() in its SIGCHLD signal handler to avoid being
102subject to a race condition. This behavior is subject to change in future
103versions of libcurl.
105## CURLAUTH_ANY
107This is a convenience macro that sets all bits and thus makes libcurl pick any
108it finds suitable. libcurl automatically selects the one it finds most secure.
110## CURLAUTH_ANYSAFE
112This is a convenience macro that sets all bits except Basic and thus makes
113libcurl pick any it finds suitable. libcurl automatically selects the one it
114finds most secure.
116## CURLAUTH_ONLY
118This is a meta symbol. OR this value together with a single specific auth
119value to force libcurl to probe for unrestricted auth and if not, only that
120single auth algorithm is acceptable.
122## CURLAUTH_AWS_SIGV4
124provides AWS V4 signature authentication on HTTPS header
125see CURLOPT_AWS_SIGV4(3).
127## CURLAUTH_HTTPSIG
129provides RFC 9421 HTTP Message Signatures on outgoing requests,
130see CURLOPT_HTTPSIG_ALGORITHM(3).
132# DEFAULT
134CURLAUTH_BASIC
136# %PROTOCOLS%
138# EXAMPLE
140~~~c
141int main(void)
143 CURL *curl = curl_easy_init();
144 if(curl) {
145 CURLcode result;
146 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
147 /* allow whatever auth the server speaks */
148 curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
149 curl_easy_setopt(curl, CURLOPT_USERPWD, "james:bond");
150 result = curl_easy_perform(curl);
151 }
153~~~
155# HISTORY
157CURLAUTH_DIGEST_IE was added in 7.19.3
159CURLAUTH_ONLY was added in 7.21.3
161CURLAUTH_NTLM_WB was added in 7.22.0
163**CURLAUTH_*** macros became `long` types in 7.26.0, prior to this version
164a `long` cast was necessary when passed to curl_easy_setopt(3).
166CURLAUTH_BEARER was added in 7.61.0
168CURLAUTH_AWS_SIGV4 was added in 7.74.0
170CURLAUTH_DIGEST_IE does nothing since 8.21.0
172CURLAUTH_HTTPSIG was added in 8.22.0
174# %AVAILABILITY%
176# RETURN VALUE
178curl_easy_setopt(3) returns a CURLcode indicating success or error.
180CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
181libcurl-errors(3).
Diagnostics4 git calls · 145 ms
CallStatusSizeTime0145 ms
discover200152 B3 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=1
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 · hit1 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=141
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=1
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
fetch2002.5 KiB141 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=2522
git.response.cache=MISS
git.response.duration_ms=141
git.fetch.wants=c9b9568c3b627bf8a9ab2a532c16142eb66abd04
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=2522
git.pkt.payload.max=2501
git.sideband.band1.bytes=2500
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
a5e369c8eb6a724e
Request
0108a6fd…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format