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 "curl_setup.h"
26#ifdef __AMIGA__
28#include "vdns/hostip.h"
29#include "curl_addrinfo.h"
30#include "amigaos.h"
32#ifdef HAVE_PROTO_BSDSOCKET_H
33# ifdef __amigaos4__
34# include <bsdsocket/socketbasetags.h>
35# elif !defined(USE_AMISSL)
36# include <amitcp/socketbasetags.h>
37# endif
38# ifdef __libnix__
39# include <stabs.h>
40# endif
41#endif
43#ifdef HAVE_PROTO_BSDSOCKET_H
45#ifdef __amigaos4__
46/*
47 * AmigaOS 4.x specific code
48 */
50/*
51 * hostip4.c - Curl_ipv4_resolve_r() replacement code
52 *
53 * Logic that needs to be considered are the following build cases:
54 * - newlib networking
55 * - clib2 networking
56 * - direct bsdsocket.library networking (usually AmiSSL builds)
57 * Each with the threaded resolver enabled or not.
58 *
59 * With the threaded resolver enabled, try to use gethostbyname_r() where
60 * available, otherwise (re)open bsdsocket.library and fallback to
61 * gethostbyname().
62 */
64#include <proto/bsdsocket.h>
66static struct SocketIFace *__CurlISocket = NULL;
67static uint32 SocketFeatures = 0;
69#define HAVE_BSDSOCKET_GETHOSTBYNAME_R 0x01
70#define HAVE_BSDSOCKET_GETADDRINFO 0x02
72CURLcode Curl_amiga_init(void)
73{
74 struct SocketIFace *ISocket;
75 struct Library *base = OpenLibrary("bsdsocket.library", 4);
77 if(base) {
78 ISocket = (struct SocketIFace *)GetInterface(base, "main", 1, NULL);
79 if(ISocket) {
80 ULONG enabled = 0;
82 SocketBaseTags(SBTM_SETVAL(SBTC_CAN_SHARE_LIBRARY_BASES), TRUE,
83 SBTM_GETREF(SBTC_HAVE_GETHOSTADDR_R_API), (ULONG)&enabled,
84 TAG_DONE);
86 if(enabled) {
87 SocketFeatures |= HAVE_BSDSOCKET_GETHOSTBYNAME_R;
88 }
90 __CurlISocket = ISocket;
92 atexit(Curl_amiga_cleanup);
94 return CURLE_OK;
95 }
96 CloseLibrary(base);
97 }
99 return CURLE_FAILED_INIT;
100}
102void Curl_amiga_cleanup(void)
103{
104 if(__CurlISocket) {
105 struct Library *base = __CurlISocket->Data.LibBase;
106 DropInterface((struct Interface *)__CurlISocket);
107 CloseLibrary(base);
108 __CurlISocket = NULL;
109 }
110}
112#ifdef CURLRES_AMIGA
113/*
114 * Because we need to handle the different cases in hostip4.c at runtime,
115 * not at compile-time, based on what was detected in Curl_amiga_init(),
116 * we replace it completely with our own as to not complicate the baseline
117 * code. Assumes malloc/calloc/free are thread-safe because Curl_he2ai()
118 * allocates memory also.
119 */
121struct Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname, uint16_t port)
122{
123 struct Curl_addrinfo *ai = NULL;
124 struct hostent *h;
125 struct SocketIFace *ISocket = __CurlISocket;
127 if(SocketFeatures & HAVE_BSDSOCKET_GETHOSTBYNAME_R) {
128 LONG h_errnop = 0;
129 struct hostent *buf;
131 buf = curlx_calloc(1, CURL_HOSTENT_SIZE);
132 if(buf) {
133 h = gethostbyname_r((STRPTR)hostname, buf,
134 (char *)buf + sizeof(struct hostent),
135 CURL_HOSTENT_SIZE - sizeof(struct hostent),
136 &h_errnop);
137 if(h) {
138 ai = Curl_he2ai(h, port);
139 }
140 curlx_free(buf);
141 }
142 }
143 else {
144#ifdef USE_RESOLV_THREADED
145 /* gethostbyname() is not thread-safe, so we need to reopen bsdsocket
146 * on the thread's context
147 */
148 struct Library *base = OpenLibrary("bsdsocket.library", 4);
149 if(base) {
150 ISocket = (struct SocketIFace *)GetInterface(base, "main", 1, NULL);
151 if(ISocket) {
152 h = gethostbyname((STRPTR)hostname);
153 if(h) {
154 ai = Curl_he2ai(h, port);
155 }
156 DropInterface((struct Interface *)ISocket);
157 }
158 CloseLibrary(base);
159 }
160#else
161 /* not using threaded resolver - safe to use this as-is */
162 h = gethostbyname(hostname);
163 if(h) {
164 ai = Curl_he2ai(h, port);
165 }
166#endif
167 }
169 return ai;
170}
171#endif /* CURLRES_AMIGA */
173#ifdef USE_AMISSL
174#include <signal.h>
175int Curl_amiga_select(int nfds, fd_set *readfds, fd_set *writefds,
176 fd_set *errorfds, struct timeval *timeout)
177{
178 int r = WaitSelect(nfds, readfds, writefds, errorfds, timeout, 0);
179 /* Ensure Ctrl-C signal is actioned */
180 if((r == -1) && (SOCKERRNO == SOCKEINTR))
181 raise(SIGINT);
182 return r;
183}
184#endif /* USE_AMISSL */
186#elif !defined(USE_AMISSL) /* __amigaos4__ */
187/*
188 * Amiga OS3 specific code
189 */
191struct Library *SocketBase = NULL;
193#ifdef __libnix__
194void __request(const char *msg);
195#define CURL_AMIGA_REQUEST(msg) __request(msg)
196#else
197#define CURL_AMIGA_REQUEST(msg) Printf((const unsigned char *)(msg "\n\a"), 0)
198#endif
200void Curl_amiga_cleanup(void)
201{
202 if(SocketBase) {
203 CloseLibrary(SocketBase);
204 SocketBase = NULL;
205 }
206}
208CURLcode Curl_amiga_init(void)
209{
210 if(!SocketBase)
211 SocketBase = OpenLibrary((const unsigned char *)"bsdsocket.library", 4);
213 if(!SocketBase) {
214 CURL_AMIGA_REQUEST("No TCP/IP Stack running!");
215 return CURLE_FAILED_INIT;
216 }
218 if(SocketBaseTags(SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (ULONG)&errno,
219 SBTM_SETVAL(SBTC_LOGTAGPTR), (ULONG)"curl", TAG_DONE)) {
220 CURL_AMIGA_REQUEST("SocketBaseTags ERROR");
221 return CURLE_FAILED_INIT;
222 }
224#ifndef __libnix__
225 atexit(Curl_amiga_cleanup);
226#endif
228 return CURLE_OK;
229}
231#ifdef __libnix__
232ADD2EXIT(Curl_amiga_cleanup, -50);
233#endif
235#endif /* !USE_AMISSL */
237#endif /* HAVE_PROTO_BSDSOCKET_H */
239#endif /* __AMIGA__ */
Diagnostics4 git calls · 49 ms
CallStatusSizeTime049 ms
discover200152 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 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 · hit25 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=25 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
fetch2002.4 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=2450 git.response.cache=HIT git.response.duration_ms=21 git.fetch.wants=3f615651838f66dbf61ee02685d7f9f67277efc5 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=2450 git.pkt.payload.max=2429 git.sideband.band1.bytes=2428 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
- a5e31994ec823e6e
- Request
- c6a9f92f…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format