Artifactspublic-v0

curl

master
ply4 git calls151 ms288 KiB2 cachedprotocol v2
89 lines2.2 KiBRaw

NAME

CURLOPT_CONNECT_ONLY - stop when connected to target server

SYNOPSIS

c
#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONNECT_ONLY, long only);

DESCRIPTION

Pass a long. If the parameter equals 1, it tells the library to perform all the required proxy authentication and connection setup, but no data transfer, and then return.

The option can be used to test a connection to a server, but is more useful when used with the CURLINFO_ACTIVESOCKET(3) option to curl_easy_getinfo(3) as the library can set up the connection and then the application can obtain the most recently used socket for special data transfers.

This option can be set to '2' and if WebSocket is used, libcurl performs the request and reads all response headers before handing over control to the application. For other protocols the behavior of '2' is undefined.

Transfers marked connect only do not reuse any existing connections and connections marked connect only are not allowed to get reused.

If the connect only transfer is done using the multi interface, the particular easy handle must remain added to the multi handle for as long as the application wants to use it. Once it has been removed with curl_multi_remove_handle(3), curl_easy_send(3) and curl_easy_recv(3) do not function.

DEFAULT

0

%PROTOCOLS%

EXAMPLE

c
int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
    curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
    result = curl_easy_perform(curl);
    if(result == CURLE_OK) {
      /* only connected */
    }
  }
}

HISTORY

WS and WSS support added in 7.86.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_CONNECT_ONLY
5Section: 3
6Source: libcurl
7See-also:
8 - CURLOPT_HTTPPROXYTUNNEL (3)
9 - CURLOPT_VERBOSE (3)
10 - curl_easy_recv (3)
11 - curl_easy_send (3)
12Protocol:
13 - All
14Added-in: 7.15.2
15---
17# NAME
19CURLOPT_CONNECT_ONLY - stop when connected to target server
21# SYNOPSIS
23~~~c
24#include <curl/curl.h>
26CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONNECT_ONLY, long only);
27~~~
29# DESCRIPTION
31Pass a long. If the parameter equals 1, it tells the library to perform all
32the required proxy authentication and connection setup, but no data transfer,
33and then return.
35The option can be used to test a connection to a server, but is more
36useful when used with the CURLINFO_ACTIVESOCKET(3) option to
37curl_easy_getinfo(3) as the library can set up the connection and then
38the application can obtain the most recently used socket for special data
39transfers.
41This option can be set to '2' and if WebSocket is used, libcurl performs the
42request and reads all response headers before handing over control to the
43application. For other protocols the behavior of '2' is undefined.
45Transfers marked connect only do not reuse any existing connections and
46connections marked connect only are not allowed to get reused.
48If the connect only transfer is done using the multi interface, the particular
49easy handle must remain added to the multi handle for as long as the
50application wants to use it. Once it has been removed with
51curl_multi_remove_handle(3), curl_easy_send(3) and
52curl_easy_recv(3) do not function.
54# DEFAULT
58# %PROTOCOLS%
60# EXAMPLE
62~~~c
63int main(void)
65 CURL *curl = curl_easy_init();
66 if(curl) {
67 CURLcode result;
68 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
69 curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
70 result = curl_easy_perform(curl);
71 if(result == CURLE_OK) {
72 /* only connected */
73 }
74 }
76~~~
78# HISTORY
80WS and WSS support added in 7.86.0.
82# %AVAILABILITY%
84# RETURN VALUE
86curl_easy_setopt(3) returns a CURLcode indicating success or error.
88CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
89libcurl-errors(3).
Diagnostics4 git calls · 151 ms
CallStatusSizeTime0151 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=2
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 · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=146
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=2
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.2 KiB146 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=1218
git.response.cache=MISS
git.response.duration_ms=146
git.fetch.wants=19154bc8440d10b6610c112b8b2422554c808ce3
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=1218
git.pkt.payload.max=1197
git.sideband.band1.bytes=1196
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
a5e3738bbabf22ce
Request
404ae52a…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format