master
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#ifdef HAVE_NETINET_IN_H
27#include <netinet/in.h>
28#endif
29#ifdef HAVE_NETDB_H
30#include <netdb.h>
31#endif
32#ifdef HAVE_ARPA_INET_H
33#include <arpa/inet.h>
34#endif
36#include "curl_addrinfo.h"
37#include "hash.h"
38#include "vdns/dnscache.h"
40static struct Curl_dnscache hp;
41static char *data_key;
42static struct Curl_dns_entry *data_node;
44static CURLcode t1305_setup(void)
45{
46 Curl_dnscache_init(&hp, 7);
47 return CURLE_OK;
48}
50static void t1305_stop(void)
51{
52 if(data_node) {
53 Curl_freeaddrinfo(data_node->addr);
54 curlx_free(data_node);
55 }
56 curlx_free(data_key);
57 Curl_dnscache_destroy(&hp);
58}
60static struct Curl_addrinfo *fake_ai(void)
61{
62 static struct Curl_addrinfo *ai;
63 static const char dummy[] = "dummy";
64 size_t namelen = sizeof(dummy); /* including the null-terminator */
66 ai = curlx_calloc(1,
67 sizeof(struct Curl_addrinfo) + sizeof(struct sockaddr_in) +
68 namelen);
69 if(!ai)
70 return NULL;
72 ai->ai_addr = (void *)((char *)ai + sizeof(struct Curl_addrinfo));
73 ai->ai_canonname = (void *)((char *)ai->ai_addr +
74 sizeof(struct sockaddr_in));
75 memcpy(ai->ai_canonname, dummy, namelen);
77 ai->ai_family = AF_INET;
78 ai->ai_addrlen = sizeof(struct sockaddr_in);
80 return ai;
81}
83static CURLcode create_node(void)
84{
85 data_key = curl_maprintf("%s:%d", "dummy", 0);
86 if(!data_key)
87 return CURLE_OUT_OF_MEMORY;
89 data_node = curlx_calloc(1, sizeof(struct Curl_dns_entry));
90 if(!data_node)
91 return CURLE_OUT_OF_MEMORY;
93 data_node->addr = fake_ai();
94 if(!data_node->addr)
95 return CURLE_OUT_OF_MEMORY;
97 return CURLE_OK;
98}
100static CURLcode test_unit1305(const char *arg)
101{
102 UNITTEST_BEGIN(t1305_setup())
104 struct Curl_dns_entry *nodep;
105 size_t key_len;
107 /* Test 1305 exits without adding anything to the hash */
108 if(testnum == 1306) {
109 CURLcode result = create_node();
110 abort_unless(result == CURLE_OK, "data node creation failed");
111 key_len = strlen(data_key);
113 data_node->refcount = 1; /* hash holds the reference */
114 nodep = Curl_hash_add(&hp.entries, data_key, key_len + 1, data_node);
115 abort_unless(nodep, "insertion into hash failed");
116 /* Freeing is done now by Curl_hash_destroy */
117 data_node = NULL;
118 }
120 UNITTEST_END(t1305_stop())
121}
Diagnostics4 git calls · 42 ms
CallStatusSizeTime042 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=4 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 · hit4 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=293470 git.response.cache=HIT git.response.duration_ms=4 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=86Open pack map
fetch2001.4 KiB · hit35 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=1429 git.response.cache=HIT git.response.duration_ms=35 git.fetch.wants=f6bf67ed36d4295e85c9493f6bf234981139f4a4 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=1429 git.pkt.payload.max=1408 git.sideband.band1.bytes=1407 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
- a5e2e610c9c12947
- Request
- 33c888c9…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format