Artifactspublic-v0

curl

master
ply4 git calls664 ms289 KiB2 cachedprotocol v2
209 lines6.0 KiBRaw
1/***************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
7 *
8 * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9 *
10 * This software is licensed as described in the file COPYING, which
11 * you should have received as part of this distribution. The terms
12 * are also available at https://curl.se/docs/copyright.html.
13 *
14 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 * copies of the Software, and permit persons to whom the Software is
16 * furnished to do so, under the terms of the COPYING file.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 * SPDX-License-Identifier: curl
22 *
23 ***************************************************************************/
24#include "curl_setup.h"
26#ifdef USE_WINDOWS_SSPI
28#include "curl_sspi.h"
29#include "curlx/strdup.h"
30#include "curlx/multibyte.h"
32/* Pointer to SSPI dispatch table */
33PSecurityFunctionTable Curl_pSecFn = NULL;
35/*
36 * Curl_sspi_global_init()
37 *
38 * This is used to load the Security Service Provider Interface (SSPI)
39 * dynamic link library portably across all Windows versions, without
40 * the need to directly link libcurl, nor the application using it, at
41 * build time.
42 *
43 * Once this function has been executed, Windows SSPI functions can be
44 * called through the Security Service Provider Interface dispatch table.
45 *
46 * Parameters:
47 *
48 * None.
49 *
50 * Returns CURLE_OK on success.
51 */
52CURLcode Curl_sspi_global_init(void)
54 /* If security interface is not yet initialized try to do this */
55 if(!Curl_pSecFn) {
56 /* Get pointer to Security Service Provider Interface dispatch table */
57 Curl_pSecFn = InitSecurityInterface();
58 if(!Curl_pSecFn)
59 return CURLE_FAILED_INIT;
60 }
62 return CURLE_OK;
65/*
66 * Curl_sspi_global_cleanup()
67 *
68 * This deinitializes the Security Service Provider Interface from libcurl.
69 *
70 * Parameters:
71 *
72 * None.
73 */
74void Curl_sspi_global_cleanup(void)
76 if(Curl_pSecFn) {
77 Curl_pSecFn = NULL;
78 }
81/*
82 * Curl_create_sspi_identity()
83 *
84 * This is used to populate an SSPI identity structure based on the supplied
85 * username and password.
86 *
87 * Parameters:
88 *
89 * userp [in] - The username in the format User or Domain\User.
90 * passwdp [in] - The user's password.
91 * identity [in/out] - The identity structure.
92 *
93 * Returns CURLE_OK on success.
94 */
95CURLcode Curl_create_sspi_identity(const char *userp, const char *passwdp,
96 SEC_WINNT_AUTH_IDENTITY_EX *identity)
98 xcharp_u useranddomain;
99 xcharp_u user, dup_user;
100 xcharp_u domain, dup_domain;
101 xcharp_u passwd, dup_passwd;
102 size_t domlen = 0;
103 size_t pwlen;
105 domain.const_tchar_ptr = _TEXT("");
107 /* Initialize the identity */
108 memset(identity, 0, sizeof(*identity));
109 identity->Version = SEC_WINNT_AUTH_IDENTITY_VERSION;
110 identity->Length = sizeof(*identity);
112 useranddomain.tchar_ptr = curlx_convert_UTF8_to_tchar(userp);
113 if(!useranddomain.tchar_ptr)
114 return CURLE_OUT_OF_MEMORY;
116 user.const_tchar_ptr = _tcschr(useranddomain.const_tchar_ptr, _TEXT('\\'));
117 if(!user.const_tchar_ptr)
118 user.const_tchar_ptr = _tcschr(useranddomain.const_tchar_ptr, _TEXT('/'));
120 if(user.tchar_ptr) {
121 domain.tchar_ptr = useranddomain.tchar_ptr;
122 domlen = user.tchar_ptr - useranddomain.tchar_ptr;
123 user.tchar_ptr++;
124 }
125 else {
126 user.tchar_ptr = useranddomain.tchar_ptr;
127 domain.const_tchar_ptr = _TEXT("");
128 domlen = 0;
129 }
131 /* Setup the identity's user and length */
132 dup_user.tchar_ptr = curlx_tcsdup(user.tchar_ptr);
133 if(!dup_user.tchar_ptr) {
134 curlx_free(useranddomain.tchar_ptr);
135 return CURLE_OUT_OF_MEMORY;
136 }
138 /* Setup the identity's domain and length */
139 dup_domain.tchar_ptr = curlx_malloc(sizeof(TCHAR) * (domlen + 1));
140 if(!dup_domain.tchar_ptr) {
141 curlx_free(dup_user.tchar_ptr);
142 curlx_free(useranddomain.tchar_ptr);
143 return CURLE_OUT_OF_MEMORY;
144 }
145 if(_tcsncpy_s(dup_domain.tchar_ptr, domlen + 1, domain.tchar_ptr, domlen)) {
146 curlx_free(dup_user.tchar_ptr);
147 curlx_free(dup_domain.tchar_ptr);
148 curlx_free(useranddomain.tchar_ptr);
149 return CURLE_OUT_OF_MEMORY;
150 }
152 curlx_free(useranddomain.tchar_ptr);
154 /* Setup the identity's password and length */
155 passwd.tchar_ptr = curlx_convert_UTF8_to_tchar(passwdp);
156 if(!passwd.tchar_ptr) {
157 curlx_free(dup_user.tchar_ptr);
158 curlx_free(dup_domain.tchar_ptr);
159 return CURLE_OUT_OF_MEMORY;
160 }
161 pwlen = _tcslen(passwd.tchar_ptr);
162 dup_passwd.tchar_ptr = curlx_tcsdup(passwd.tchar_ptr);
163 if(!dup_passwd.tchar_ptr) {
164 curlx_free(dup_user.tchar_ptr);
165 curlx_free(dup_domain.tchar_ptr);
166 curlx_memzero(passwd.tchar_ptr, pwlen * sizeof(*passwd.tchar_ptr));
167 curlx_free(passwd.tchar_ptr);
168 return CURLE_OUT_OF_MEMORY;
169 }
170 identity->Password = dup_passwd.tbyte_ptr;
171 identity->PasswordLength = curlx_uztoul(pwlen);
172 dup_passwd.tchar_ptr = NULL;
174 curlx_memzero(passwd.tchar_ptr, pwlen * sizeof(*passwd.tchar_ptr));
175 curlx_free(passwd.tchar_ptr);
177 identity->User = dup_user.tbyte_ptr;
178 identity->UserLength = curlx_uztoul(_tcslen(dup_user.tchar_ptr));
179 dup_user.tchar_ptr = NULL;
180 identity->Domain = dup_domain.tbyte_ptr;
181 identity->DomainLength = curlx_uztoul(domlen);
182 dup_domain.tchar_ptr = NULL;
184 identity->Flags = CURL_SEC_WINNT_AUTH_IDENTITY;
186 return CURLE_OK;
189/*
190 * Curl_sspi_free_identity()
191 *
192 * This is used to free the contents of an SSPI identifier structure.
193 *
194 * Parameters:
195 *
196 * identity [in/out] - The identity structure.
197 */
198void Curl_sspi_free_identity(SEC_WINNT_AUTH_IDENTITY_EX *identity)
200 if(identity) {
201 curlx_safefree(identity->User);
202 curlx_memzero(identity->Password,
203 identity->PasswordLength * sizeof(*identity->Password));
204 curlx_safefree(identity->Password);
205 curlx_safefree(identity->Domain);
206 }
209#endif /* USE_WINDOWS_SSPI */
Diagnostics4 git calls · 664 ms
CallStatusSizeTime0664 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 · hit3 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=3
git.response.bytes=149
git.response.cache=HIT
git.response.duration_ms=3
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=658
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
fetch2002.0 KiB658 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=1998
git.response.cache=MISS
git.response.duration_ms=658
git.fetch.wants=799f3429a4721ff33a701ed034e8aa77ee402443
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=1998
git.pkt.payload.max=1977
git.sideband.band1.bytes=1976
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
a5e2f5fc18fc3a24
Request
468234e1…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format