Artifactspublic-v0

curl

master
ply4 git calls32 ms290 KiB3 cachedprotocol v2
280 lines9.9 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.
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.
18# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19# KIND, either express or implied.
21# SPDX-License-Identifier: curl
23###########################################################################
24# File defines convenience macros for available feature testing
26# Check if header file exists and add it to the list.
27# This macro is intended to be called multiple times with a sequence of
28# possibly dependent header files. Some headers depend on others to be
29# compiled correctly.
30macro(check_include_file_concat_curl _file _variable)
31 check_include_files("${CURL_INCLUDES};${_file}" ${_variable})
32 if(${_variable})
33 list(APPEND CURL_INCLUDES ${_file})
34 endif()
35endmacro()
37set(CURL_TEST_DEFINES "") # Initialize global variable
39# For other curl specific tests, use this macro.
40# Return result in variable: CURL_TEST_OUTPUT
41macro(curl_internal_test _curl_test)
42 if(NOT DEFINED "${_curl_test}")
43 message(STATUS "Performing Test ${_curl_test}")
44 try_compile(${_curl_test}
45 ${PROJECT_BINARY_DIR}
46 "${PROJECT_SOURCE_DIR}/CMake/CurlTests.c"
47 COMPILE_DEFINITIONS "-D${_curl_test}" ${CURL_TEST_DEFINES} ${CMAKE_REQUIRED_FLAGS} ${CMAKE_REQUIRED_DEFINITIONS}
48 LINK_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}"
49 OUTPUT_VARIABLE CURL_TEST_OUTPUT)
50 if(${_curl_test})
51 set(${_curl_test} 1 CACHE INTERNAL "curl test")
52 message(STATUS "Performing Test ${_curl_test} - Success")
53 else()
54 set(${_curl_test} "" CACHE INTERNAL "curl test")
55 message(STATUS "Performing Test ${_curl_test} - Failed")
56 endif()
57 endif()
58endmacro()
60# Option for dependencies that accepts an 'AUTO' value, which enables the dependency if detected.
61macro(curl_dependency_option _option_name _find_name _desc_name)
62 set(${_option_name} "AUTO" CACHE STRING "Build curl with ${_desc_name} support (AUTO, ON or OFF)")
63 set_property(CACHE ${_option_name} PROPERTY STRINGS "AUTO" "ON" "OFF")
65 if(${_option_name} STREQUAL "AUTO")
66 if(_find_name STREQUAL "ZLIB")
67 find_package(${_find_name})
68 else()
69 find_package(${_find_name} MODULE)
70 endif()
71 elseif(${_option_name})
72 if(_find_name STREQUAL "ZLIB")
73 find_package(${_find_name} REQUIRED)
74 else()
75 find_package(${_find_name} MODULE REQUIRED)
76 endif()
77 else()
78 string(TOUPPER "${_find_name}" _find_name_upper)
79 set(${_find_name}_FOUND OFF) # cmake-lint: disable=C0103
80 set(${_find_name_upper}_FOUND OFF) # cmake-lint: disable=C0103
81 endif()
82endmacro()
84# Convert the passed paths to libpath linker options and add them to CMAKE_REQUIRED_*.
85macro(curl_required_libpaths _libpaths_arg)
86 if(CMAKE_VERSION VERSION_LESS 3.31)
87 set(_libpaths "${_libpaths_arg}")
88 foreach(_libpath IN LISTS _libpaths)
89 list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "${CMAKE_LIBRARY_PATH_FLAG}${_libpath}")
90 endforeach()
91 else()
92 list(APPEND CMAKE_REQUIRED_LINK_DIRECTORIES "${_libpaths_arg}")
93 endif()
94endmacro()
96# Pre-fill variables set by a check_type_size() call.
97macro(curl_prefill_type_size _type _size)
98 set(HAVE_SIZEOF_${_type} TRUE)
99 set(SIZEOF_${_type} ${_size})
100 set(SIZEOF_${_type}_CODE "#define SIZEOF_${_type} ${_size}")
101endmacro()
103# Internal: Recurse into target libraries and collect their include directories
104# and macro definitions.
105macro(curl_collect_target_compile_options _target)
106 get_target_property(_val ${_target} INTERFACE_COMPILE_DEFINITIONS)
107 if(_val)
108 list(APPEND _definitions ${_val})
109 endif()
110 get_target_property(_val ${_target} INTERFACE_INCLUDE_DIRECTORIES)
111 if(_val)
112 list(APPEND _incsys ${_val})
113 endif()
114 get_target_property(_val ${_target} INTERFACE_COMPILE_OPTIONS)
115 if(_val)
116 list(APPEND _options ${_val})
117 endif()
118 get_target_property(_val ${_target} LINK_LIBRARIES)
119 if(_val)
120 foreach(_lib IN LISTS _val)
121 if(TARGET "${_lib}")
122 curl_collect_target_compile_options(${_lib})
123 endif()
124 endforeach()
125 endif()
126 unset(_val)
127endmacro()
129# Create a clang-tidy target for test targets
130function(curl_add_clang_tidy_test_target _target_clang_tidy _target)
131 if(CURL_CLANG_TIDY)
133 set(_definitions "")
134 set(_includes "")
135 set(_incsys "")
136 set(_options "")
138 # Make a list of known system include directories
139 set(_sys_incdirs "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
140 foreach(_inc IN LISTS CMAKE_SYSTEM_PREFIX_PATH)
141 if(NOT _inc MATCHES "/$")
142 string(APPEND _inc "/")
143 endif()
144 string(APPEND _inc "include")
145 if(NOT _inc IN_LIST _sys_incdirs AND IS_DIRECTORY "${_inc}")
146 list(APPEND _sys_incdirs "${_inc}")
147 endif()
148 endforeach()
150 # Collect options applying to the directory
151 get_directory_property(_val COMPILE_DEFINITIONS)
152 if(_val)
153 list(APPEND _definitions ${_val})
154 endif()
155 get_directory_property(_val INCLUDE_DIRECTORIES)
156 if(_val)
157 list(APPEND _includes ${_val})
158 endif()
159 get_directory_property(_val COMPILE_OPTIONS)
160 if(_val)
161 list(APPEND _options ${_val})
162 endif()
164 # Collect options applying to the target
165 get_target_property(_val ${_target} COMPILE_DEFINITIONS)
166 if(_val)
167 list(APPEND _definitions ${_val})
168 endif()
169 get_target_property(_val ${_target} INCLUDE_DIRECTORIES)
170 if(_val)
171 list(APPEND _includes ${_val})
172 endif()
173 get_target_property(_val ${_target} COMPILE_OPTIONS)
174 if(_val)
175 list(APPEND _options ${_val})
176 endif()
178 # Collect header directories and macro definitions from lib dependencies
179 curl_collect_target_compile_options(${_target})
181 list(REMOVE_ITEM _definitions "")
182 string(REPLACE ";" ";-D" _definitions ";${_definitions}")
183 list(REMOVE_DUPLICATES _definitions)
184 list(SORT _definitions) # Sort like CMake does
186 list(REMOVE_ITEM _includes "")
187 string(REPLACE ";" ";-I" _includes ";${_includes}")
188 list(REMOVE_DUPLICATES _includes)
190 set(_incsys_tmp ${_incsys})
191 list(REMOVE_DUPLICATES _incsys_tmp)
192 set(_incsys "")
193 set(_incsystop "")
194 foreach(_inc IN LISTS _incsys_tmp)
195 if(_inc IN_LIST _sys_incdirs)
196 list(APPEND _incsystop "${_inc}") # Save system prefixes to re-add them later to the end of list
197 continue()
198 endif()
199 # Avoid empty and '$<INSTALL_INTERFACE:include>' items. The latter
200 # evaluates to an empty path in this context. Also skip
201 # '$<BUILD_INTERFACE:curl-include>', as already present in '_includes'.
202 if(_inc AND
203 NOT _inc MATCHES "INSTALL_INTERFACE:" AND
204 NOT _inc MATCHES "BUILD_INTERFACE:")
205 list(APPEND _incsys "-isystem" "${_inc}")
206 endif()
207 endforeach()
208 foreach(_inc IN LISTS _incsystop)
209 list(APPEND _incsys "-isystem" "${_inc}")
210 endforeach()
212 if(CMAKE_C_COMPILER_ID MATCHES "Clang")
213 list(REMOVE_DUPLICATES _options) # Keep the first of duplicates to imitate CMake
214 else()
215 set(_options)
216 endif()
218 # Assemble source list
219 set(_sources "")
220 foreach(_source IN ITEMS ${ARGN})
221 if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_source}") # if not in source tree
222 set(_source "${CMAKE_CURRENT_BINARY_DIR}/${_source}") # look in the build tree, for generated files, e.g. lib1521.c
223 endif()
224 list(APPEND _sources "${_source}")
225 endforeach()
227 set(_cc "${CMAKE_C_COMPILER}")
228 if(CMAKE_C_COMPILER_TARGET AND CMAKE_C_COMPILE_OPTIONS_TARGET)
229 list(APPEND _cc "${CMAKE_C_COMPILE_OPTIONS_TARGET}${CMAKE_C_COMPILER_TARGET}")
230 endif()
231 if(APPLE AND CMAKE_OSX_SYSROOT)
232 list(APPEND _cc "-isysroot" "${CMAKE_OSX_SYSROOT}")
233 elseif(CMAKE_SYSROOT AND CMAKE_C_COMPILE_OPTIONS_SYSROOT)
234 list(APPEND _cc "${CMAKE_C_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT}")
235 endif()
237 # Pass -clang-diagnostic-unused-function to disable -Wunused-function implied by -Wunused
238 add_custom_target(${_target_clang_tidy} USES_TERMINAL
239 WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
240 COMMAND ${CMAKE_C_CLANG_TIDY}
241 "--checks=-clang-diagnostic-unused-function"
242 ${_sources} -- ${_cc} ${_definitions} ${_includes} ${_incsys} ${_options}
243 DEPENDS ${_sources})
244 add_dependencies(tests-clang-tidy ${_target_clang_tidy})
245 endif()
246endfunction()
248# Internal: Recurse into interface targets and collect their libraries
249# and library paths.
250macro(curl_collect_target_link_options _target)
251 get_target_property(_val ${_target} INTERFACE_LINK_DIRECTORIES)
252 if(_val)
253 list(APPEND _libdirs ${_val})
254 endif()
255 get_target_property(_val ${_target} IMPORTED)
256 if(_val)
257 # LOCATION is empty for interface library targets and safe to ignore.
258 # Explicitly skip this query to avoid CMake 3.18 and older erroring out.
259 get_target_property(_val ${_target} TYPE)
260 if(NOT "${_val}" STREQUAL "INTERFACE_LIBRARY")
261 get_target_property(_val ${_target} LOCATION)
262 if(_val)
263 list(APPEND _libs ${_val})
264 endif()
265 endif()
266 endif()
267 get_target_property(_val ${_target} INTERFACE_LINK_LIBRARIES)
268 if(_val)
269 foreach(_lib IN LISTS _val)
270 # Extract imported target name from e.g. "$<LINK_ONLY:OpenSSL::Crypto>" set by libssh2
271 string(REGEX REPLACE "^\\\$<LINK_ONLY:(.*)>\$" "\\1" _lib "${_lib}")
272 if(TARGET "${_lib}")
273 curl_collect_target_link_options(${_lib})
274 else()
275 list(APPEND _libs ${_lib})
276 endif()
277 endforeach()
278 endif()
279 unset(_val)
280endmacro()
Diagnostics4 git calls · 32 ms
CallStatusSizeTime032 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 · 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 · hit4 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=25
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=86
Open pack map
fetch2003.4 KiB · hit25 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=3471
git.response.cache=HIT
git.response.duration_ms=25
git.fetch.wants=503074a0a02b45403459691c79cc9e9324b67a0e
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=3471
git.pkt.payload.max=3450
git.sideband.band1.bytes=3449
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
a5e309824b2dee28
Request
9fafbaba…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format