Artifactspublic-v0

curl

master
ply4 git calls30 ms288 KiB3 cachedprotocol v2
125 lines4.4 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 "unitcheck.h"
26#if defined(USE_GNUTLS) || defined(USE_SCHANNEL) || defined(USE_MBEDTLS)
27#include "vtls/x509asn1.h"
29struct test_spec {
30 const char *input;
31 const char *exp_output;
32 CURLcode result_exp;
33};
35static bool do_test(const struct test_spec *spec, size_t i,
36 struct dynbuf *dbuf)
38 CURLcode result;
39 const char *in = spec->input;
41 curlx_dyn_reset(dbuf);
42 result = GTime2str(dbuf, in, in + strlen(in));
43 if(result != spec->result_exp) {
44 curl_mfprintf(stderr, "test %zu: expect result %d, got %d\n",
45 i, (int)spec->result_exp, (int)result);
46 return FALSE;
47 }
48 else if(!result && strcmp(spec->exp_output, curlx_dyn_ptr(dbuf))) {
49 curl_mfprintf(stderr,
50 "test %zu: input '%s', expected output '%s', got '%s'\n",
51 i, in, spec->exp_output, curlx_dyn_ptr(dbuf));
52 return FALSE;
53 }
55 return TRUE;
58static CURLcode test_unit1656(const char *arg)
60 UNITTEST_BEGIN_SIMPLE
62 static const struct test_spec test_specs[] = {
63 { "190321134340", "1903-21-13 43:40:00", CURLE_OK },
64 { "", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
65 { "WTF", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
66 { "0WTF", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
67 { "19032113434", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
68 { "19032113434WTF", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
69 { "190321134340.", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
70 { "190321134340.1", "1903-21-13 43:40:00.1", CURLE_OK },
71 { "19032113434017.0", "1903-21-13 43:40:17", CURLE_OK },
72 { "19032113434017.01", "1903-21-13 43:40:17.01", CURLE_OK },
73 { "19032113434003.001", "1903-21-13 43:40:03.001", CURLE_OK },
74 { "19032113434003.090", "1903-21-13 43:40:03.09", CURLE_OK },
75 { "190321134340Z", "1903-21-13 43:40:00 GMT", CURLE_OK },
76 { "19032113434017.0Z", "1903-21-13 43:40:17 GMT", CURLE_OK },
77 { "19032113434017.01Z", "1903-21-13 43:40:17.01 GMT", CURLE_OK },
78 { "19032113434003.001Z", "1903-21-13 43:40:03.001 GMT", CURLE_OK },
79 { "19032113434003.090Z", "1903-21-13 43:40:03.09 GMT", CURLE_OK },
80 { "190321134340CET", "1903-21-13 43:40:00 CET", CURLE_OK },
81 { "19032113434017.0CET", "1903-21-13 43:40:17 CET", CURLE_OK },
82 { "19032113434017.01CET", "1903-21-13 43:40:17.01 CET", CURLE_OK },
83 { "190321134340+02:30", "1903-21-13 43:40:00 UTC+02:30", CURLE_OK },
84 { "19032113434017.0+02:30", "1903-21-13 43:40:17 UTC+02:30", CURLE_OK },
85 { "19032113434017.01+02:30", "1903-21-13 43:40:17.01 UTC+02:30",
86 CURLE_OK },
87 { "190321134340-3", "1903-21-13 43:40:00 UTC-3", CURLE_OK },
88 { "19032113434017.0-04", "1903-21-13 43:40:17 UTC-04", CURLE_OK },
89 { "19032113434017.01-01:10", "1903-21-13 43:40:17.01 UTC-01:10",
90 CURLE_OK },
91 };
93 size_t i;
94 struct dynbuf dbuf;
95 bool all_ok = TRUE;
97 if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
98 curl_mfprintf(stderr, "curl_global_init() failed\n");
99 return TEST_ERR_MAJOR_BAD;
100 }
102 curlx_dyn_init(&dbuf, 32 * 1024);
104 for(i = 0; i < CURL_ARRAYSIZE(test_specs); ++i) {
105 if(!do_test(&test_specs[i], i, &dbuf))
106 all_ok = FALSE;
107 }
108 fail_unless(all_ok, "some tests of Curl_x509_GTime2str() fails");
110 curlx_dyn_free(&dbuf);
111 curl_global_cleanup();
113 UNITTEST_END_SIMPLE
116#else
118static CURLcode test_unit1656(const char *arg)
120 UNITTEST_BEGIN_SIMPLE
121 puts("not tested since Curl_x509_GTime2str() is not built in");
122 UNITTEST_END_SIMPLE
125#endif
Diagnostics4 git calls · 30 ms
CallStatusSizeTime030 ms
discover200152 B5 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=5
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 · hit6 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=6
git.response.bytes=149
git.response.cache=HIT
git.response.duration_ms=6
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=3
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.5 KiB · hit21 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=21
git.response.bytes=1542
git.response.cache=HIT
git.response.duration_ms=21
git.fetch.wants=4dea282c9e601dec398bc8af9d3296adb14bdf1a
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=1542
git.pkt.payload.max=1521
git.sideband.band1.bytes=1520
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
a5e2e8514b42ecfa
Request
a169aa26…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format