Artifactspublic-v0

curl

master
ply4 git calls63 ms288 KiB3 cachedprotocol v2
102 lines2.8 KiBRaw

NAME

curl_easy_ssls_import - import SSL sessions

SYNOPSIS

c
#include <curl/curl.h>

CURLcode curl_easy_ssls_import(CURL *handle,
                               const char *session_key,
                               const unsigned char *shmac, size_t shmac_len,
                               const unsigned char *sdata, size_t sdata_len);

DESCRIPTION

This function imports a previously exported SSL session ticket. sdata and sdata_len must always be provided. If session_key is NULL, then shmac and shmac_len must be given as received during the export. See curl_easy_ssls_export(3) for a description of those.

Import of session tickets from other curl versions may fail due to changes in the handling of shmac or sdata. A session ticket which has already expired is silently discarded.

The session key identifies origin and used TLS configurations. Configuration parameters identified by a file path are only matched to the path, not the file's content. It is the applications responsibility to handle updates to CA, CRL or key files, e.g. discarding previous sessions. Otherwise, imported sessions may establish trusted connections to servers that would fail to verify otherwise.

Most TLS sessions handed out by servers have a short lifetime. If continued use of these sessions is acceptable can only be decided by the application. Also, TLS session that are tied to client authentication, e.g. a client certificate, are never exported by libcurl.

%PROTOCOLS%

EXAMPLE

c
extern unsigned char *shmac, *sdata;

int main(void)
{
  CURLSHcode sh;
  CURLSH *share = curl_share_init();
  CURLcode result;
  CURL *curl;

  sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
  if(sh)
    printf("Error: %s\n", curl_share_strerror(sh));

  curl = curl_easy_init();
  if(curl) {
    size_t hlen = 4, slen = 5;

    curl_easy_setopt(curl, CURLOPT_SHARE, share);

    /* read shmac and sdata from storage */
    result = curl_easy_ssls_import(curl, NULL, shmac, hlen, sdata, slen);

    /* always cleanup */
    curl_easy_cleanup(curl);
  }
  curl_share_cleanup(share);
}

%AVAILABILITY%

RETURN VALUE

This function returns a CURLcode indicating success or error.

CURLE_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3) there can be an error message stored in the error buffer when non-zero is returned.

1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: curl_easy_ssls_import
5Section: 3
6Source: libcurl
7See-also:
8 - CURLOPT_SHARE (3)
9 - curl_share_setopt (3)
10 - curl_easy_ssls_export (3)
11Protocol:
12 - TLS
13TLS-backend:
14 - GnuTLS
15 - OpenSSL
16 - wolfSSL
17 - mbedTLS
18Added-in: 8.12.0
19---
21# NAME
23curl_easy_ssls_import - import SSL sessions
25# SYNOPSIS
27~~~c
28#include <curl/curl.h>
30CURLcode curl_easy_ssls_import(CURL *handle,
31 const char *session_key,
32 const unsigned char *shmac, size_t shmac_len,
33 const unsigned char *sdata, size_t sdata_len);
34~~~
36# DESCRIPTION
38This function imports a previously exported SSL session ticket. **sdata** and
39**sdata_len** must always be provided. If **session_key** is **NULL**, then
40**shmac** and **shmac_len** must be given as received during the export.
41See curl_easy_ssls_export(3) for a description of those.
43Import of session tickets from other curl versions may fail due to changes
44in the handling of **shmac** or **sdata**. A session ticket which has
45already expired is silently discarded.
47The session key identifies origin and used TLS configurations. Configuration
48parameters identified by a file path are only matched to the path, not the
49file's content. It is the applications responsibility to handle updates to
50CA, CRL or key files, e.g. discarding previous sessions. Otherwise,
51imported sessions may establish trusted connections to servers that would fail
52to verify otherwise.
54Most TLS sessions handed out by servers have a short lifetime. If
55continued use of these sessions is acceptable can only be decided by
56the application. Also, TLS session that are tied to client authentication,
57e.g. a client certificate, are never exported by libcurl.
59# %PROTOCOLS%
61# EXAMPLE
63~~~c
64extern unsigned char *shmac, *sdata;
66int main(void)
68 CURLSHcode sh;
69 CURLSH *share = curl_share_init();
70 CURLcode result;
71 CURL *curl;
73 sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
74 if(sh)
75 printf("Error: %s\n", curl_share_strerror(sh));
77 curl = curl_easy_init();
78 if(curl) {
79 size_t hlen = 4, slen = 5;
81 curl_easy_setopt(curl, CURLOPT_SHARE, share);
83 /* read shmac and sdata from storage */
84 result = curl_easy_ssls_import(curl, NULL, shmac, hlen, sdata, slen);
86 /* always cleanup */
87 curl_easy_cleanup(curl);
88 }
89 curl_share_cleanup(share);
91~~~
93# %AVAILABILITY%
95# RETURN VALUE
97This function returns a CURLcode indicating success or error.
99CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
100libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
101there can be an error message stored in the error buffer when non-zero is
102returned.
Diagnostics4 git calls · 63 ms
CallStatusSizeTime063 ms
discover200152 B2 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
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 · hit26 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=26
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 KiB · hit35 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=35
git.response.bytes=1457
git.response.cache=HIT
git.response.duration_ms=35
git.fetch.wants=c154984591481ea11b5b51a86319e3562d758957
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=1457
git.pkt.payload.max=1436
git.sideband.band1.bytes=1435
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
a5e35c57df06dfff
Request
4b851e63…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format