Kitxuuu commited on
Commit
f4637db
·
verified ·
1 Parent(s): 16d249d

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. local-test-curl-delta-01/afc-curl/CHANGES.md +12 -0
  2. local-test-curl-delta-01/afc-curl/CMakeLists.txt +2355 -0
  3. local-test-curl-delta-01/afc-curl/COPYING +22 -0
  4. local-test-curl-delta-01/afc-curl/Dockerfile +41 -0
  5. local-test-curl-delta-01/afc-curl/GIT-INFO.md +32 -0
  6. local-test-curl-delta-01/afc-curl/Makefile.am +252 -0
  7. local-test-curl-delta-01/afc-curl/Makefile.dist +71 -0
  8. local-test-curl-delta-01/afc-curl/README +55 -0
  9. local-test-curl-delta-01/afc-curl/README.md +68 -0
  10. local-test-curl-delta-01/afc-curl/RELEASE-NOTES +197 -0
  11. local-test-curl-delta-01/afc-curl/REUSE.toml +57 -0
  12. local-test-curl-delta-01/afc-curl/SECURITY.md +29 -0
  13. local-test-curl-delta-01/afc-curl/acinclude.m4 +1697 -0
  14. local-test-curl-delta-01/afc-curl/appveyor.sh +159 -0
  15. local-test-curl-delta-01/afc-curl/appveyor.yml +222 -0
  16. local-test-curl-delta-01/afc-curl/buildconf +8 -0
  17. local-test-curl-delta-01/afc-curl/buildconf.bat +265 -0
  18. local-test-curl-delta-01/afc-curl/configure.ac +0 -0
  19. local-test-curl-delta-01/afc-curl/curl-config.in +195 -0
  20. local-test-curl-delta-01/afc-curl/libcurl.pc.in +41 -0
  21. local-test-curl-delta-01/diff/ref.diff +785 -0
  22. local-test-curl-delta-01/fuzz-tooling/CITATION.cff +46 -0
  23. local-test-curl-delta-01/fuzz-tooling/CONTRIBUTING.md +26 -0
  24. local-test-curl-delta-01/fuzz-tooling/LICENSE +201 -0
  25. local-test-curl-delta-01/fuzz-tooling/README.md +135 -0
  26. local-test-curl-delta-01/fuzz-tooling/docs/.gitignore +5 -0
  27. local-test-curl-delta-01/fuzz-tooling/docs/404.html +23 -0
  28. local-test-curl-delta-01/fuzz-tooling/docs/Gemfile +4 -0
  29. local-test-curl-delta-01/fuzz-tooling/docs/README.md +19 -0
  30. local-test-curl-delta-01/fuzz-tooling/docs/_config.yml +40 -0
  31. local-test-curl-delta-01/fuzz-tooling/docs/faq.md +237 -0
  32. local-test-curl-delta-01/fuzz-tooling/docs/favicon.ico +0 -0
  33. local-test-curl-delta-01/fuzz-tooling/docs/glossary.md +1 -0
  34. local-test-curl-delta-01/fuzz-tooling/docs/ideal_integration.md +1 -0
  35. local-test-curl-delta-01/fuzz-tooling/docs/index.md +88 -0
  36. local-test-curl-delta-01/fuzz-tooling/docs/new_project_guide.md +1 -0
  37. local-test-curl-delta-01/fuzz-tooling/docs/reproducing.md +1 -0
  38. local-test-curl-delta-01/fuzz-tooling/infra/.dockerignore +9 -0
  39. local-test-curl-delta-01/fuzz-tooling/infra/MAINTAINERS.csv +7 -0
  40. local-test-curl-delta-01/fuzz-tooling/infra/README.md +23 -0
  41. local-test-curl-delta-01/fuzz-tooling/infra/__pycache__/templates.cpython-312.pyc +0 -0
  42. local-test-curl-delta-01/fuzz-tooling/infra/base-images/README.md +6 -0
  43. local-test-curl-delta-01/fuzz-tooling/infra/base-images/aixcc_build_all.sh +59 -0
  44. local-test-curl-delta-01/fuzz-tooling/infra/base-images/all.sh +28 -0
  45. local-test-curl-delta-01/fuzz-tooling/infra/bisector.py +318 -0
  46. local-test-curl-delta-01/fuzz-tooling/infra/bisector_test.py +70 -0
  47. local-test-curl-delta-01/fuzz-tooling/infra/build_fuzzers.Dockerfile +31 -0
  48. local-test-curl-delta-01/fuzz-tooling/infra/build_specified_commit.py +410 -0
  49. local-test-curl-delta-01/fuzz-tooling/infra/build_specified_commit_test.py +126 -0
  50. local-test-curl-delta-01/fuzz-tooling/infra/ci/requirements.txt +9 -0
local-test-curl-delta-01/afc-curl/CHANGES.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3
+
4
+ SPDX-License-Identifier: curl
5
+ -->
6
+
7
+ In a release tarball, check the RELEASES-NOTES file for what was done in the
8
+ most recent release. In a git check-out, that file mentions changes that have
9
+ been done since the previous release.
10
+
11
+ See the online [changelog](https://curl.se/changes.html) for the edited and
12
+ human readable version of what has changed in different curl releases.
local-test-curl-delta-01/afc-curl/CMakeLists.txt ADDED
@@ -0,0 +1,2355 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # by Tetetest and Sukender (Benoit Neil)
25
+
26
+ # Note: By default this CMake build script detects the version of some
27
+ # dependencies using `check_symbol_exists`. Those checks do not work in
28
+ # the case that both CURL and its dependency are included as sub-projects
29
+ # in a larger build using `FetchContent`. To support that case, additional
30
+ # variables may be defined by the parent project, ideally in the "extra"
31
+ # find package redirect file:
32
+ # https://cmake.org/cmake/help/latest/module/FetchContent.html#integrating-with-find-package
33
+ #
34
+ # The following variables are available:
35
+ # HAVE_SSL_SET0_WBIO: `SSL_set0_wbio` present in OpenSSL/wolfSSL
36
+ # HAVE_OPENSSL_SRP: `SSL_CTX_set_srp_username` present in OpenSSL/wolfSSL
37
+ # HAVE_GNUTLS_SRP: `gnutls_srp_verifier` present in GnuTLS
38
+ # HAVE_SSL_CTX_SET_QUIC_METHOD: `SSL_CTX_set_quic_method` present in OpenSSL/wolfSSL
39
+ # HAVE_QUICHE_CONN_SET_QLOG_FD: `quiche_conn_set_qlog_fd` present in quiche
40
+ # HAVE_ECH: ECH API checks for OpenSSL, BoringSSL or wolfSSL
41
+ #
42
+ # For each of the above variables, if the variable is DEFINED (either
43
+ # to ON or OFF), the symbol detection is skipped. If the variable is
44
+ # NOT DEFINED, the symbol detection is performed.
45
+
46
+ cmake_minimum_required(VERSION 3.7...3.16 FATAL_ERROR)
47
+ message(STATUS "Using CMake version ${CMAKE_VERSION}")
48
+
49
+ # Collect command-line arguments for buildinfo.txt.
50
+ # Must reside at the top of the script to work as expected.
51
+ set(_cmake_args "")
52
+ if(NOT "$ENV{CURL_BUILDINFO}$ENV{CURL_CI}$ENV{CI}" STREQUAL "")
53
+ get_cmake_property(_cache_vars CACHE_VARIABLES)
54
+ foreach(_cache_var IN ITEMS ${_cache_vars})
55
+ get_property(_cache_var_helpstring CACHE ${_cache_var} PROPERTY HELPSTRING)
56
+ if(_cache_var_helpstring STREQUAL "No help, variable specified on the command line.")
57
+ get_property(_cache_var_type CACHE ${_cache_var} PROPERTY TYPE)
58
+ get_property(_cache_var_value CACHE ${_cache_var} PROPERTY VALUE)
59
+ if(_cache_var_type STREQUAL "UNINITIALIZED")
60
+ set(_cache_var_type)
61
+ else()
62
+ set(_cache_var_type ":${_cache_var_type}")
63
+ endif()
64
+ set(_cmake_args "${_cmake_args} -D${_cache_var}${_cache_var_type}=\"${_cache_var_value}\"")
65
+ endif()
66
+ endforeach()
67
+ endif()
68
+
69
+ function(curl_dumpvars) # Dump all defined variables with their values
70
+ message("::group::CMake Variable Dump")
71
+ get_cmake_property(_vars VARIABLES)
72
+ foreach(_var ${_vars})
73
+ message("${_var} = ${${_var}}")
74
+ endforeach()
75
+ message("::endgroup::")
76
+ endfunction()
77
+
78
+ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}")
79
+ include(Utilities)
80
+ include(Macros)
81
+ include(CMakeDependentOption)
82
+ include(CheckCCompilerFlag)
83
+
84
+ file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/include/curl/curlver.h" _curl_version_h_contents REGEX "#define LIBCURL_VERSION( |_NUM )")
85
+ string(REGEX MATCH "#define LIBCURL_VERSION \"[^\"]*" _curl_version ${_curl_version_h_contents})
86
+ string(REGEX REPLACE "[^\"]+\"" "" _curl_version ${_curl_version})
87
+ string(REGEX MATCH "#define LIBCURL_VERSION_NUM 0x[0-9a-fA-F]+" _curl_version_num ${_curl_version_h_contents})
88
+ string(REGEX REPLACE "[^0]+0x" "" _curl_version_num ${_curl_version_num})
89
+ unset(_curl_version_h_contents)
90
+
91
+ message(STATUS "curl version=[${_curl_version}]")
92
+
93
+ string(REGEX REPLACE "([0-9]+\.[0-9]+\.[0-9]+).+" "\\1" _curl_version_sem "${_curl_version}")
94
+ project(CURL
95
+ VERSION "${_curl_version_sem}"
96
+ LANGUAGES C)
97
+
98
+ unset(_target_flags)
99
+ if(APPLE)
100
+ set(_target_flags "${_target_flags} APPLE")
101
+ endif()
102
+ if(UNIX)
103
+ set(_target_flags "${_target_flags} UNIX")
104
+ endif()
105
+ if(BSD)
106
+ set(_target_flags "${_target_flags} BSD")
107
+ endif()
108
+ if(WIN32)
109
+ set(_target_flags "${_target_flags} WIN32")
110
+ endif()
111
+ if(WINDOWS_STORE)
112
+ set(_target_flags "${_target_flags} UWP")
113
+ endif()
114
+ if(CYGWIN)
115
+ set(_target_flags "${_target_flags} CYGWIN")
116
+ endif()
117
+ if(MSYS)
118
+ set(_target_flags "${_target_flags} MSYS")
119
+ endif()
120
+ if(CMAKE_COMPILER_IS_GNUCC)
121
+ set(_target_flags "${_target_flags} GCC")
122
+ endif()
123
+ if(MINGW)
124
+ set(_target_flags "${_target_flags} MINGW")
125
+ endif()
126
+ if(MSVC)
127
+ set(_target_flags "${_target_flags} MSVC")
128
+ endif()
129
+ if(VCPKG_TOOLCHAIN)
130
+ set(_target_flags "${_target_flags} VCPKG")
131
+ endif()
132
+ if(CMAKE_CROSSCOMPILING)
133
+ set(_target_flags "${_target_flags} CROSS")
134
+ endif()
135
+ message(STATUS "CMake platform flags:${_target_flags}")
136
+
137
+ if(CMAKE_CROSSCOMPILING)
138
+ message(STATUS "Cross-compiling: "
139
+ "${CMAKE_HOST_SYSTEM_NAME}/${CMAKE_HOST_SYSTEM_PROCESSOR} -> "
140
+ "${CMAKE_SYSTEM_NAME}/${CMAKE_SYSTEM_PROCESSOR}")
141
+ endif()
142
+
143
+ if(CMAKE_C_COMPILER_TARGET)
144
+ set(CURL_OS "\"${CMAKE_C_COMPILER_TARGET}\"")
145
+ else()
146
+ set(CURL_OS "\"${CMAKE_SYSTEM_NAME}\"")
147
+ endif()
148
+
149
+ include_directories("${PROJECT_SOURCE_DIR}/include")
150
+
151
+ if(NOT DEFINED CMAKE_UNITY_BUILD_BATCH_SIZE)
152
+ set(CMAKE_UNITY_BUILD_BATCH_SIZE 0)
153
+ endif()
154
+
155
+ # Having CMAKE_TRY_COMPILE_TARGET_TYPE set to STATIC_LIBRARY breaks certain
156
+ # 'check_function_exists()' detections (possibly more), by detecting
157
+ # non-existing features. This happens by default when using 'ios.toolchain.cmake'.
158
+ # Work it around by setting this value to `EXECUTABLE`.
159
+ if(CMAKE_TRY_COMPILE_TARGET_TYPE STREQUAL "STATIC_LIBRARY")
160
+ message(STATUS "CMAKE_TRY_COMPILE_TARGET_TYPE was found set to STATIC_LIBRARY. "
161
+ "Overriding with EXECUTABLE for feature detections to work.")
162
+ set(_cmake_try_compile_target_type_save ${CMAKE_TRY_COMPILE_TARGET_TYPE})
163
+ set(CMAKE_TRY_COMPILE_TARGET_TYPE "EXECUTABLE")
164
+ endif()
165
+
166
+ option(CURL_WERROR "Turn compiler warnings into errors" OFF)
167
+ option(PICKY_COMPILER "Enable picky compiler options" ON)
168
+ option(BUILD_CURL_EXE "Build curl executable" ON)
169
+ option(BUILD_SHARED_LIBS "Build shared libraries" ON)
170
+ option(BUILD_STATIC_LIBS "Build static libraries" OFF)
171
+ option(BUILD_STATIC_CURL "Build curl executable with static libcurl" OFF)
172
+ option(ENABLE_ARES "Enable c-ares support" OFF)
173
+ option(CURL_DISABLE_INSTALL "Disable installation targets" OFF)
174
+
175
+ if(WIN32)
176
+ option(CURL_STATIC_CRT "Build libcurl with static CRT with MSVC (/MT)" OFF)
177
+ if(CURL_STATIC_CRT AND MSVC)
178
+ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
179
+ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
180
+ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
181
+ endif()
182
+
183
+ option(ENABLE_UNICODE "Use the Unicode version of the Windows API functions" OFF)
184
+ if(WINDOWS_STORE)
185
+ set(ENABLE_UNICODE ON)
186
+ endif()
187
+ if(ENABLE_UNICODE)
188
+ add_definitions("-DUNICODE" "-D_UNICODE")
189
+ if(MINGW)
190
+ add_compile_options("-municode")
191
+ endif()
192
+ endif()
193
+
194
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS "-DWIN32_LEAN_AND_MEAN") # Apply to all feature checks
195
+
196
+ set(CURL_TARGET_WINDOWS_VERSION "" CACHE STRING "Minimum target Windows version as hex string")
197
+ if(CURL_TARGET_WINDOWS_VERSION)
198
+ add_definitions("-D_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}")
199
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}") # Apply to all feature checks
200
+ endif()
201
+
202
+ # Detect actual value of _WIN32_WINNT and store as HAVE_WIN32_WINNT
203
+ curl_internal_test(HAVE_WIN32_WINNT)
204
+ if(HAVE_WIN32_WINNT)
205
+ string(REGEX MATCH ".*_WIN32_WINNT=0x[0-9a-fA-F]+" CURL_TEST_OUTPUT "${CURL_TEST_OUTPUT}")
206
+ string(REGEX REPLACE ".*_WIN32_WINNT=" "" CURL_TEST_OUTPUT "${CURL_TEST_OUTPUT}")
207
+ string(REGEX REPLACE "0x([0-9a-f][0-9a-f][0-9a-f])$" "0x0\\1" CURL_TEST_OUTPUT "${CURL_TEST_OUTPUT}") # pad to 4 digits
208
+ string(TOLOWER "${CURL_TEST_OUTPUT}" HAVE_WIN32_WINNT)
209
+ message(STATUS "Found _WIN32_WINNT=${HAVE_WIN32_WINNT}")
210
+ endif()
211
+ # Avoid storing HAVE_WIN32_WINNT in CMake cache
212
+ unset(HAVE_WIN32_WINNT CACHE)
213
+ endif()
214
+ option(CURL_LTO "Enable compiler Link Time Optimizations" OFF)
215
+
216
+ cmake_dependent_option(ENABLE_THREADED_RESOLVER "Enable threaded DNS lookup"
217
+ ON "NOT ENABLE_ARES"
218
+ OFF)
219
+
220
+ include(PickyWarnings)
221
+
222
+ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
223
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE") # Required for sendmmsg()
224
+ endif()
225
+
226
+ option(ENABLE_DEBUG "Enable curl debug features (for developing curl itself)" OFF)
227
+ if(ENABLE_DEBUG)
228
+ message(WARNING "This curl build is Debug-enabled, do not use in production.")
229
+ endif()
230
+ option(ENABLE_CURLDEBUG "Enable TrackMemory debug feature" ${ENABLE_DEBUG})
231
+
232
+ if(MSVC)
233
+ set(ENABLE_CURLDEBUG OFF) # FIXME: TrackMemory + MSVC fails test 558 and 1330. Tested with static build, Debug mode.
234
+ endif()
235
+
236
+ if(ENABLE_DEBUG)
237
+ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "DEBUGBUILD")
238
+ endif()
239
+
240
+ if(ENABLE_CURLDEBUG)
241
+ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "CURLDEBUG")
242
+ endif()
243
+
244
+ # For debug libs and exes, add "-d" postfix
245
+ if(NOT DEFINED CMAKE_DEBUG_POSTFIX)
246
+ set(CMAKE_DEBUG_POSTFIX "-d")
247
+ endif()
248
+
249
+ set(LIB_STATIC "libcurl_static")
250
+ set(LIB_SHARED "libcurl_shared")
251
+
252
+ if(NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS)
253
+ set(BUILD_STATIC_LIBS ON)
254
+ endif()
255
+ if(NOT BUILD_STATIC_CURL AND NOT BUILD_SHARED_LIBS)
256
+ set(BUILD_STATIC_CURL ON)
257
+ elseif(BUILD_STATIC_CURL AND NOT BUILD_STATIC_LIBS)
258
+ set(BUILD_STATIC_CURL OFF)
259
+ endif()
260
+
261
+ # Lib flavour selected for curl tool
262
+ if(BUILD_STATIC_CURL)
263
+ set(LIB_SELECTED_FOR_EXE ${LIB_STATIC})
264
+ else()
265
+ set(LIB_SELECTED_FOR_EXE ${LIB_SHARED})
266
+ endif()
267
+
268
+ # Lib flavour selected for example and test programs.
269
+ if(BUILD_SHARED_LIBS)
270
+ set(LIB_SELECTED ${LIB_SHARED})
271
+ else()
272
+ set(LIB_SELECTED ${LIB_STATIC})
273
+ endif()
274
+
275
+ # Override to force-disable or force-enable the use of pkg-config.
276
+ if(UNIX OR VCPKG_TOOLCHAIN OR (MINGW AND NOT CMAKE_CROSSCOMPILING)) # Keep in sync with CMake/curl-config.cmake.in
277
+ set(_curl_use_pkgconfig_default ON)
278
+ else()
279
+ set(_curl_use_pkgconfig_default OFF)
280
+ endif()
281
+ option(CURL_USE_PKGCONFIG "Enable pkg-config to detect dependencies" ${_curl_use_pkgconfig_default})
282
+
283
+ # Initialize variables collecting dependency libs, paths, pkg-config names.
284
+ set(CURL_LIBS "")
285
+ set(CURL_LIBDIRS "")
286
+ set(LIBCURL_PC_REQUIRES_PRIVATE "")
287
+
288
+ if(ENABLE_ARES)
289
+ set(USE_ARES 1)
290
+ find_package(Cares REQUIRED)
291
+ list(APPEND CURL_LIBS ${CARES_LIBRARIES})
292
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libcares")
293
+ add_definitions("-DCARES_NO_DEPRECATED") # Ignore c-ares deprecation warnings
294
+ endif()
295
+
296
+ include(CurlSymbolHiding)
297
+
298
+ option(CURL_ENABLE_EXPORT_TARGET "Enable CMake export target" ON)
299
+ mark_as_advanced(CURL_ENABLE_EXPORT_TARGET)
300
+
301
+ option(CURL_DISABLE_ALTSVC "Disable alt-svc support" OFF)
302
+ mark_as_advanced(CURL_DISABLE_ALTSVC)
303
+ option(CURL_DISABLE_SRP "Disable TLS-SRP support" OFF)
304
+ mark_as_advanced(CURL_DISABLE_SRP)
305
+ option(CURL_DISABLE_COOKIES "Disable cookies support" OFF)
306
+ mark_as_advanced(CURL_DISABLE_COOKIES)
307
+ option(CURL_DISABLE_BASIC_AUTH "Disable Basic authentication" OFF)
308
+ mark_as_advanced(CURL_DISABLE_BASIC_AUTH)
309
+ option(CURL_DISABLE_BEARER_AUTH "Disable Bearer authentication" OFF)
310
+ mark_as_advanced(CURL_DISABLE_BEARER_AUTH)
311
+ option(CURL_DISABLE_DIGEST_AUTH "Disable Digest authentication" OFF)
312
+ mark_as_advanced(CURL_DISABLE_DIGEST_AUTH)
313
+ option(CURL_DISABLE_KERBEROS_AUTH "Disable Kerberos authentication" OFF)
314
+ mark_as_advanced(CURL_DISABLE_KERBEROS_AUTH)
315
+ option(CURL_DISABLE_NEGOTIATE_AUTH "Disable negotiate authentication" OFF)
316
+ mark_as_advanced(CURL_DISABLE_NEGOTIATE_AUTH)
317
+ option(CURL_DISABLE_AWS "Disable aws-sigv4" OFF)
318
+ mark_as_advanced(CURL_DISABLE_AWS)
319
+ option(CURL_DISABLE_DICT "Disable DICT" OFF)
320
+ mark_as_advanced(CURL_DISABLE_DICT)
321
+ option(CURL_DISABLE_DOH "Disable DNS-over-HTTPS" OFF)
322
+ mark_as_advanced(CURL_DISABLE_DOH)
323
+ option(CURL_DISABLE_FILE "Disable FILE" OFF)
324
+ mark_as_advanced(CURL_DISABLE_FILE)
325
+ option(CURL_DISABLE_FTP "Disable FTP" OFF)
326
+ mark_as_advanced(CURL_DISABLE_FTP)
327
+ option(CURL_DISABLE_GETOPTIONS "Disable curl_easy_options API for existing options to curl_easy_setopt" OFF)
328
+ mark_as_advanced(CURL_DISABLE_GETOPTIONS)
329
+ option(CURL_DISABLE_GOPHER "Disable Gopher" OFF)
330
+ mark_as_advanced(CURL_DISABLE_GOPHER)
331
+ option(CURL_DISABLE_HEADERS_API "Disable headers-api support" OFF)
332
+ mark_as_advanced(CURL_DISABLE_HEADERS_API)
333
+ option(CURL_DISABLE_HSTS "Disable HSTS support" OFF)
334
+ mark_as_advanced(CURL_DISABLE_HSTS)
335
+ option(CURL_DISABLE_HTTP "Disable HTTP" OFF)
336
+ mark_as_advanced(CURL_DISABLE_HTTP)
337
+ option(CURL_DISABLE_HTTP_AUTH "Disable all HTTP authentication methods" OFF)
338
+ mark_as_advanced(CURL_DISABLE_HTTP_AUTH)
339
+ option(CURL_DISABLE_IMAP "Disable IMAP" OFF)
340
+ mark_as_advanced(CURL_DISABLE_IMAP)
341
+ option(CURL_DISABLE_LDAP "Disable LDAP" OFF)
342
+ mark_as_advanced(CURL_DISABLE_LDAP)
343
+ option(CURL_DISABLE_LDAPS "Disable LDAPS" ${CURL_DISABLE_LDAP})
344
+ mark_as_advanced(CURL_DISABLE_LDAPS)
345
+ option(CURL_DISABLE_LIBCURL_OPTION "Disable --libcurl option from the curl tool" OFF)
346
+ mark_as_advanced(CURL_DISABLE_LIBCURL_OPTION)
347
+ option(CURL_DISABLE_MIME "Disable MIME support" OFF)
348
+ mark_as_advanced(CURL_DISABLE_MIME)
349
+ cmake_dependent_option(CURL_DISABLE_FORM_API "Disable form-api"
350
+ OFF "NOT CURL_DISABLE_MIME"
351
+ ON)
352
+ mark_as_advanced(CURL_DISABLE_FORM_API)
353
+ option(CURL_DISABLE_MQTT "Disable MQTT" OFF)
354
+ mark_as_advanced(CURL_DISABLE_MQTT)
355
+ option(CURL_DISABLE_BINDLOCAL "Disable local binding support" OFF)
356
+ mark_as_advanced(CURL_DISABLE_BINDLOCAL)
357
+ option(CURL_DISABLE_NETRC "Disable netrc parser" OFF)
358
+ mark_as_advanced(CURL_DISABLE_NETRC)
359
+ option(CURL_DISABLE_NTLM "Disable NTLM support" OFF)
360
+ mark_as_advanced(CURL_DISABLE_NTLM)
361
+ option(CURL_DISABLE_PARSEDATE "Disable date parsing" OFF)
362
+ mark_as_advanced(CURL_DISABLE_PARSEDATE)
363
+ option(CURL_DISABLE_POP3 "Disable POP3" OFF)
364
+ mark_as_advanced(CURL_DISABLE_POP3)
365
+ option(CURL_DISABLE_PROGRESS_METER "Disable built-in progress meter" OFF)
366
+ mark_as_advanced(CURL_DISABLE_PROGRESS_METER)
367
+ option(CURL_DISABLE_PROXY "Disable proxy support" OFF)
368
+ mark_as_advanced(CURL_DISABLE_PROXY)
369
+ option(CURL_DISABLE_IPFS "Disable IPFS" OFF)
370
+ mark_as_advanced(CURL_DISABLE_IPFS)
371
+ option(CURL_DISABLE_RTSP "Disable RTSP" OFF)
372
+ mark_as_advanced(CURL_DISABLE_SHA512_256)
373
+ option(CURL_DISABLE_SHA512_256 "Disable SHA-512/256 hash algorithm" OFF)
374
+ mark_as_advanced(CURL_DISABLE_RTSP)
375
+ option(CURL_DISABLE_SHUFFLE_DNS "Disable shuffle DNS feature" OFF)
376
+ mark_as_advanced(CURL_DISABLE_SHUFFLE_DNS)
377
+ option(CURL_DISABLE_SMB "Disable SMB" OFF)
378
+ mark_as_advanced(CURL_DISABLE_SMB)
379
+ option(CURL_DISABLE_SMTP "Disable SMTP" OFF)
380
+ mark_as_advanced(CURL_DISABLE_SMTP)
381
+ option(CURL_DISABLE_SOCKETPAIR "Disable use of socketpair for curl_multi_poll" OFF)
382
+ mark_as_advanced(CURL_DISABLE_SOCKETPAIR)
383
+ option(CURL_DISABLE_WEBSOCKETS "Disable WebSocket" OFF)
384
+ mark_as_advanced(CURL_DISABLE_WEBSOCKETS)
385
+ option(CURL_DISABLE_TELNET "Disable Telnet" OFF)
386
+ mark_as_advanced(CURL_DISABLE_TELNET)
387
+ option(CURL_DISABLE_TFTP "Disable TFTP" OFF)
388
+ mark_as_advanced(CURL_DISABLE_TFTP)
389
+ option(CURL_DISABLE_VERBOSE_STRINGS "Disable verbose strings" OFF)
390
+ mark_as_advanced(CURL_DISABLE_VERBOSE_STRINGS)
391
+
392
+ if(CURL_DISABLE_HTTP)
393
+ set(CURL_DISABLE_IPFS ON)
394
+ set(CURL_DISABLE_RTSP ON)
395
+ set(CURL_DISABLE_ALTSVC ON)
396
+ set(CURL_DISABLE_HSTS ON)
397
+ endif()
398
+
399
+ # Corresponds to HTTP_ONLY in lib/curl_setup.h
400
+ option(HTTP_ONLY "Disable all protocols except HTTP (This overrides all CURL_DISABLE_* options)" OFF)
401
+ mark_as_advanced(HTTP_ONLY)
402
+
403
+ if(HTTP_ONLY)
404
+ set(CURL_DISABLE_DICT ON)
405
+ set(CURL_DISABLE_FILE ON)
406
+ set(CURL_DISABLE_FTP ON)
407
+ set(CURL_DISABLE_GOPHER ON)
408
+ set(CURL_DISABLE_IMAP ON)
409
+ set(CURL_DISABLE_LDAP ON)
410
+ set(CURL_DISABLE_LDAPS ON)
411
+ set(CURL_DISABLE_MQTT ON)
412
+ set(CURL_DISABLE_POP3 ON)
413
+ set(CURL_DISABLE_IPFS ON)
414
+ set(CURL_DISABLE_RTSP ON)
415
+ set(CURL_DISABLE_SMB ON)
416
+ set(CURL_DISABLE_SMTP ON)
417
+ set(CURL_DISABLE_TELNET ON)
418
+ set(CURL_DISABLE_TFTP ON)
419
+ endif()
420
+
421
+ if(WINDOWS_STORE)
422
+ set(CURL_DISABLE_TELNET ON) # telnet code needs fixing to compile for UWP.
423
+ endif()
424
+
425
+ option(ENABLE_IPV6 "Enable IPv6 support" ON)
426
+ mark_as_advanced(ENABLE_IPV6)
427
+ if(ENABLE_IPV6 AND NOT WIN32)
428
+ include(CheckStructHasMember)
429
+ check_struct_has_member("struct sockaddr_in6" "sin6_addr" "netinet/in.h" HAVE_SOCKADDR_IN6_SIN6_ADDR)
430
+ check_struct_has_member("struct sockaddr_in6" "sin6_scope_id" "netinet/in.h" HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID)
431
+ if(NOT HAVE_SOCKADDR_IN6_SIN6_ADDR)
432
+ message(WARNING "struct sockaddr_in6 not available, disabling IPv6 support")
433
+ # Force the feature off as this name is used as guard macro...
434
+ set(ENABLE_IPV6 OFF CACHE BOOL "Enable IPv6 support" FORCE)
435
+ endif()
436
+
437
+ if(APPLE AND NOT ENABLE_ARES)
438
+ set(_use_core_foundation_and_core_services ON)
439
+
440
+ find_library(SYSTEMCONFIGURATION_FRAMEWORK "SystemConfiguration")
441
+ mark_as_advanced(SYSTEMCONFIGURATION_FRAMEWORK)
442
+ if(NOT SYSTEMCONFIGURATION_FRAMEWORK)
443
+ message(FATAL_ERROR "SystemConfiguration framework not found")
444
+ endif()
445
+
446
+ list(APPEND CURL_LIBS "-framework SystemConfiguration")
447
+ endif()
448
+ endif()
449
+ if(ENABLE_IPV6)
450
+ set(USE_IPV6 ON)
451
+ endif()
452
+
453
+ find_package(Perl)
454
+
455
+ option(BUILD_LIBCURL_DOCS "Build libcurl man pages" ON)
456
+ option(BUILD_MISC_DOCS "Build misc man pages (e.g. curl-config and mk-ca-bundle)" ON)
457
+ option(ENABLE_CURL_MANUAL "Build the man page for curl and enable its -M/--manual option" ON)
458
+
459
+ if(ENABLE_CURL_MANUAL OR BUILD_LIBCURL_DOCS)
460
+ if(PERL_FOUND)
461
+ set(HAVE_MANUAL_TOOLS ON)
462
+ endif()
463
+ if(NOT HAVE_MANUAL_TOOLS)
464
+ message(WARNING "Perl not found. Will not build manuals.")
465
+ endif()
466
+ endif()
467
+
468
+ # Disable warnings on Borland to avoid changing 3rd party code.
469
+ if(BORLAND)
470
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-")
471
+ endif()
472
+
473
+ # If we are on AIX, do the _ALL_SOURCE magic
474
+ if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
475
+ add_definitions("-D_ALL_SOURCE")
476
+ endif()
477
+
478
+ # If we are on Haiku, make sure that the network library is brought in.
479
+ if(CMAKE_SYSTEM_NAME STREQUAL "Haiku")
480
+ list(APPEND CURL_LIBS "network")
481
+ endif()
482
+
483
+ # Include all the necessary files for macros
484
+ include(CMakePushCheckState)
485
+ include(CheckFunctionExists)
486
+ include(CheckIncludeFile)
487
+ include(CheckIncludeFiles)
488
+ include(CheckLibraryExists)
489
+ include(CheckSymbolExists)
490
+ include(CheckTypeSize)
491
+ include(CheckCSourceCompiles)
492
+
493
+ # Preload settings on Windows
494
+ if(WIN32)
495
+ include("${CMAKE_CURRENT_SOURCE_DIR}/CMake/Platforms/WindowsCache.cmake")
496
+ elseif(APPLE)
497
+ # Fast-track predictable feature detections
498
+ set(HAVE_EVENTFD 0)
499
+ set(HAVE_GETPASS_R 0)
500
+ set(HAVE_SENDMMSG 0)
501
+ endif()
502
+
503
+ if(ENABLE_THREADED_RESOLVER)
504
+ if(WIN32)
505
+ set(USE_THREADS_WIN32 ON)
506
+ else()
507
+ find_package(Threads REQUIRED)
508
+ set(USE_THREADS_POSIX ${CMAKE_USE_PTHREADS_INIT})
509
+ set(HAVE_PTHREAD_H ${CMAKE_USE_PTHREADS_INIT})
510
+ list(APPEND CURL_LIBS ${CMAKE_THREAD_LIBS_INIT})
511
+ endif()
512
+ endif()
513
+
514
+ # Check for all needed libraries
515
+ if(NOT WIN32 AND NOT APPLE)
516
+ check_library_exists("socket" "connect" "" HAVE_LIBSOCKET)
517
+ if(HAVE_LIBSOCKET)
518
+ set(CURL_LIBS "socket;${CURL_LIBS}")
519
+ endif()
520
+ endif()
521
+
522
+ check_function_exists("gethostname" HAVE_GETHOSTNAME)
523
+
524
+ if(WIN32)
525
+ list(APPEND CURL_LIBS "ws2_32" "bcrypt")
526
+ endif()
527
+
528
+ # Check SSL libraries
529
+ option(CURL_ENABLE_SSL "Enable SSL support" ON)
530
+
531
+ if(CURL_DEFAULT_SSL_BACKEND)
532
+ set(_valid_default_ssl_backend FALSE)
533
+ endif()
534
+
535
+ if(APPLE)
536
+ cmake_dependent_option(CURL_USE_SECTRANSP "Enable Apple OS native SSL/TLS (Secure Transport)" OFF CURL_ENABLE_SSL OFF)
537
+ endif()
538
+ if(WIN32)
539
+ cmake_dependent_option(CURL_USE_SCHANNEL "Enable Windows native SSL/TLS (Schannel)" OFF CURL_ENABLE_SSL OFF)
540
+ option(CURL_WINDOWS_SSPI "Enable SSPI on Windows" ${CURL_USE_SCHANNEL})
541
+ endif()
542
+ cmake_dependent_option(CURL_USE_MBEDTLS "Enable mbedTLS for SSL/TLS" OFF CURL_ENABLE_SSL OFF)
543
+ cmake_dependent_option(CURL_USE_BEARSSL "Enable BearSSL for SSL/TLS" OFF CURL_ENABLE_SSL OFF)
544
+ cmake_dependent_option(CURL_USE_WOLFSSL "Enable wolfSSL for SSL/TLS" OFF CURL_ENABLE_SSL OFF)
545
+ cmake_dependent_option(CURL_USE_GNUTLS "Enable GnuTLS for SSL/TLS" OFF CURL_ENABLE_SSL OFF)
546
+ cmake_dependent_option(CURL_USE_RUSTLS "Enable Rustls for SSL/TLS" OFF CURL_ENABLE_SSL OFF)
547
+
548
+ if(WIN32 OR
549
+ CURL_USE_SECTRANSP OR
550
+ CURL_USE_SCHANNEL OR
551
+ CURL_USE_MBEDTLS OR
552
+ CURL_USE_BEARSSL OR
553
+ CURL_USE_WOLFSSL OR
554
+ CURL_USE_GNUTLS OR
555
+ CURL_USE_RUSTLS)
556
+ set(_openssl_default OFF)
557
+ else()
558
+ set(_openssl_default ON)
559
+ endif()
560
+ cmake_dependent_option(CURL_USE_OPENSSL "Enable OpenSSL for SSL/TLS" ${_openssl_default} CURL_ENABLE_SSL OFF)
561
+ option(USE_OPENSSL_QUIC "Use OpenSSL and nghttp3 libraries for HTTP/3 support" OFF)
562
+ if(USE_OPENSSL_QUIC AND NOT CURL_USE_OPENSSL)
563
+ message(WARNING "OpenSSL QUIC has been requested, but without enabling OpenSSL. Will not enable QUIC.")
564
+ set(USE_OPENSSL_QUIC OFF)
565
+ endif()
566
+ option(CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG "Disable automatic loading of OpenSSL configuration" OFF)
567
+
568
+ count_true(_enabled_ssl_options_count
569
+ CURL_USE_SCHANNEL
570
+ CURL_USE_SECTRANSP
571
+ CURL_USE_OPENSSL
572
+ CURL_USE_MBEDTLS
573
+ CURL_USE_BEARSSL
574
+ CURL_USE_WOLFSSL
575
+ CURL_USE_GNUTLS
576
+ CURL_USE_RUSTLS
577
+ )
578
+ if(_enabled_ssl_options_count GREATER 1)
579
+ set(CURL_WITH_MULTI_SSL ON)
580
+ elseif(_enabled_ssl_options_count EQUAL 0)
581
+ set(CURL_DISABLE_HSTS ON)
582
+ endif()
583
+
584
+ if(CURL_USE_SCHANNEL)
585
+ set(_ssl_enabled ON)
586
+ set(USE_SCHANNEL ON) # Windows native SSL/TLS support
587
+ set(USE_WINDOWS_SSPI ON) # CURL_USE_SCHANNEL implies CURL_WINDOWS_SSPI
588
+
589
+ if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "schannel")
590
+ set(_valid_default_ssl_backend TRUE)
591
+ endif()
592
+ endif()
593
+ if(CURL_WINDOWS_SSPI)
594
+ set(USE_WINDOWS_SSPI ON)
595
+ endif()
596
+
597
+ if(CURL_USE_SECTRANSP)
598
+ set(_use_core_foundation_and_core_services ON)
599
+
600
+ find_library(SECURITY_FRAMEWORK "Security")
601
+ mark_as_advanced(SECURITY_FRAMEWORK)
602
+ if(NOT SECURITY_FRAMEWORK)
603
+ message(FATAL_ERROR "Security framework not found")
604
+ endif()
605
+
606
+ set(_ssl_enabled ON)
607
+ set(USE_SECTRANSP ON)
608
+ list(APPEND CURL_LIBS "-framework Security")
609
+
610
+ if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "secure-transport")
611
+ set(_valid_default_ssl_backend TRUE)
612
+ endif()
613
+
614
+ message(WARNING "Secure Transport does not support TLS 1.3.")
615
+ endif()
616
+
617
+ if(_use_core_foundation_and_core_services)
618
+ find_library(COREFOUNDATION_FRAMEWORK "CoreFoundation")
619
+ mark_as_advanced(COREFOUNDATION_FRAMEWORK)
620
+ find_library(CORESERVICES_FRAMEWORK "CoreServices")
621
+ mark_as_advanced(CORESERVICES_FRAMEWORK)
622
+
623
+ if(NOT COREFOUNDATION_FRAMEWORK)
624
+ message(FATAL_ERROR "CoreFoundation framework not found")
625
+ endif()
626
+ if(NOT CORESERVICES_FRAMEWORK)
627
+ message(FATAL_ERROR "CoreServices framework not found")
628
+ endif()
629
+
630
+ list(APPEND CURL_LIBS "-framework CoreFoundation" "-framework CoreServices")
631
+ endif()
632
+
633
+ if(CURL_USE_OPENSSL)
634
+ find_package(OpenSSL REQUIRED)
635
+ set(_ssl_enabled ON)
636
+ set(USE_OPENSSL ON)
637
+
638
+ # Depend on OpenSSL via imported targets. This allows our dependents to
639
+ # get our dependencies transitively.
640
+ list(APPEND CURL_LIBS OpenSSL::SSL OpenSSL::Crypto)
641
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "openssl")
642
+
643
+ if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "openssl")
644
+ set(_valid_default_ssl_backend TRUE)
645
+ endif()
646
+ set(_curl_ca_bundle_supported TRUE)
647
+
648
+ cmake_push_check_state()
649
+ set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
650
+ if(NOT DEFINED HAVE_BORINGSSL)
651
+ check_symbol_exists("OPENSSL_IS_BORINGSSL" "openssl/base.h" HAVE_BORINGSSL)
652
+ endif()
653
+ if(NOT DEFINED HAVE_AWSLC)
654
+ check_symbol_exists("OPENSSL_IS_AWSLC" "openssl/base.h" HAVE_AWSLC)
655
+ endif()
656
+ cmake_pop_check_state()
657
+ endif()
658
+
659
+ if(CURL_USE_MBEDTLS)
660
+ find_package(MbedTLS REQUIRED)
661
+ set(_ssl_enabled ON)
662
+ set(USE_MBEDTLS ON)
663
+ list(APPEND CURL_LIBS ${MBEDTLS_LIBRARIES})
664
+ list(APPEND CURL_LIBDIRS ${MBEDTLS_LIBRARY_DIRS})
665
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${MBEDTLS_PC_REQUIRES})
666
+ include_directories(SYSTEM ${MBEDTLS_INCLUDE_DIRS})
667
+ link_directories(${MBEDTLS_LIBRARY_DIRS})
668
+ if(MBEDTLS_CFLAGS)
669
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MBEDTLS_CFLAGS}")
670
+ endif()
671
+
672
+ if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "mbedtls")
673
+ set(_valid_default_ssl_backend TRUE)
674
+ endif()
675
+ set(_curl_ca_bundle_supported TRUE)
676
+ endif()
677
+
678
+ if(CURL_USE_BEARSSL)
679
+ find_package(BearSSL REQUIRED)
680
+ set(_ssl_enabled ON)
681
+ set(USE_BEARSSL ON)
682
+ list(APPEND CURL_LIBS ${BEARSSL_LIBRARIES})
683
+ include_directories(SYSTEM ${BEARSSL_INCLUDE_DIRS})
684
+
685
+ if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "bearssl")
686
+ set(_valid_default_ssl_backend TRUE)
687
+ endif()
688
+ set(_curl_ca_bundle_supported TRUE)
689
+
690
+ message(WARNING "BearSSL does not support TLS 1.3.")
691
+ endif()
692
+
693
+ if(CURL_USE_WOLFSSL)
694
+ find_package(WolfSSL REQUIRED)
695
+ set(_ssl_enabled ON)
696
+ set(USE_WOLFSSL ON)
697
+ list(APPEND CURL_LIBS ${WOLFSSL_LIBRARIES})
698
+ list(APPEND CURL_LIBDIRS ${WOLFSSL_LIBRARY_DIRS})
699
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "wolfssl")
700
+ include_directories(SYSTEM ${WOLFSSL_INCLUDE_DIRS})
701
+ link_directories(${WOLFSSL_LIBRARY_DIRS})
702
+ if(WOLFSSL_CFLAGS)
703
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WOLFSSL_CFLAGS}")
704
+ endif()
705
+
706
+ if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "wolfssl")
707
+ set(_valid_default_ssl_backend TRUE)
708
+ endif()
709
+ set(_curl_ca_bundle_supported TRUE)
710
+ endif()
711
+
712
+ if(CURL_USE_GNUTLS)
713
+ if(CURL_USE_PKGCONFIG)
714
+ find_package(PkgConfig QUIET)
715
+ pkg_check_modules(GNUTLS "gnutls")
716
+ if(GNUTLS_FOUND)
717
+ set(GNUTLS_LIBRARIES ${GNUTLS_LINK_LIBRARIES})
718
+ endif()
719
+ endif()
720
+ if(NOT GNUTLS_FOUND)
721
+ find_package(GnuTLS REQUIRED)
722
+ endif()
723
+ find_package(Nettle REQUIRED)
724
+ set(_ssl_enabled ON)
725
+ set(USE_GNUTLS ON)
726
+ list(APPEND CURL_LIBS ${GNUTLS_LIBRARIES} ${NETTLE_LIBRARIES})
727
+ list(APPEND CURL_LIBDIRS ${NETTLE_LIBRARY_DIRS})
728
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "gnutls" "nettle")
729
+ include_directories(SYSTEM ${GNUTLS_INCLUDE_DIRS} ${NETTLE_INCLUDE_DIRS})
730
+ link_directories(${NETTLE_LIBRARY_DIRS})
731
+ if(NETTLE_CFLAGS)
732
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NETTLE_CFLAGS}")
733
+ endif()
734
+
735
+ if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "gnutls")
736
+ set(_valid_default_ssl_backend TRUE)
737
+ endif()
738
+ set(_curl_ca_bundle_supported TRUE)
739
+
740
+ if(NOT DEFINED HAVE_GNUTLS_SRP AND NOT CURL_DISABLE_SRP)
741
+ cmake_push_check_state()
742
+ set(CMAKE_REQUIRED_INCLUDES ${GNUTLS_INCLUDE_DIRS})
743
+ set(CMAKE_REQUIRED_LIBRARIES ${GNUTLS_LIBRARIES})
744
+ check_symbol_exists("gnutls_srp_verifier" "gnutls/gnutls.h" HAVE_GNUTLS_SRP)
745
+ cmake_pop_check_state()
746
+ endif()
747
+ endif()
748
+
749
+ if(CURL_USE_RUSTLS)
750
+ find_package(Rustls REQUIRED)
751
+ set(_ssl_enabled ON)
752
+ set(USE_RUSTLS ON)
753
+ list(APPEND CURL_LIBS ${RUSTLS_LIBRARIES})
754
+ list(APPEND CURL_LIBDIRS ${RUSTLS_LIBRARY_DIRS})
755
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${RUSTLS_PC_REQUIRES})
756
+ include_directories(SYSTEM ${RUSTLS_INCLUDE_DIRS})
757
+ link_directories(${RUSTLS_LIBRARY_DIRS})
758
+ if(RUSTLS_CFLAGS)
759
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${RUSTLS_CFLAGS}")
760
+ endif()
761
+
762
+ if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "rustls")
763
+ set(_valid_default_ssl_backend TRUE)
764
+ endif()
765
+ set(_curl_ca_bundle_supported TRUE)
766
+ endif()
767
+
768
+ if(CURL_DEFAULT_SSL_BACKEND AND NOT _valid_default_ssl_backend)
769
+ message(FATAL_ERROR "CURL_DEFAULT_SSL_BACKEND '${CURL_DEFAULT_SSL_BACKEND}' not enabled.")
770
+ endif()
771
+
772
+ # Keep ZLIB detection after TLS detection,
773
+ # and before calling openssl_check_symbol_exists().
774
+
775
+ set(HAVE_LIBZ OFF)
776
+ curl_dependency_option(ZLIB)
777
+ if(ZLIB_FOUND)
778
+ set(HAVE_LIBZ ON)
779
+
780
+ # Depend on ZLIB via imported targets. This allows our dependents to
781
+ # get our dependencies transitively.
782
+ list(APPEND CURL_LIBS ZLIB::ZLIB)
783
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "zlib")
784
+ endif()
785
+
786
+ option(CURL_BROTLI "Use brotli" OFF)
787
+ set(HAVE_BROTLI OFF)
788
+ if(CURL_BROTLI)
789
+ find_package(Brotli REQUIRED)
790
+ if(BROTLI_FOUND)
791
+ set(HAVE_BROTLI ON)
792
+ list(APPEND CURL_LIBS ${BROTLI_LIBRARIES})
793
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libbrotlidec")
794
+ include_directories(SYSTEM ${BROTLI_INCLUDE_DIRS})
795
+ endif()
796
+ endif()
797
+
798
+ option(CURL_ZSTD "Use zstd" OFF)
799
+ set(HAVE_ZSTD OFF)
800
+ if(CURL_ZSTD)
801
+ find_package(Zstd REQUIRED)
802
+ if(ZSTD_FOUND AND NOT ZSTD_VERSION VERSION_LESS 1.0.0)
803
+ set(HAVE_ZSTD ON)
804
+ list(APPEND CURL_LIBS ${ZSTD_LIBRARIES})
805
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libzstd")
806
+ include_directories(SYSTEM ${ZSTD_INCLUDE_DIRS})
807
+ else()
808
+ message(WARNING "zstd v1.0.0 or newer is required, disabling zstd support.")
809
+ endif()
810
+ endif()
811
+
812
+ # Check symbol in an OpenSSL-like TLS backend, or in _extra_libs depending on it.
813
+ macro(openssl_check_symbol_exists _symbol _files _variable _extra_libs)
814
+ cmake_push_check_state()
815
+ if(USE_OPENSSL)
816
+ set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}")
817
+ set(CMAKE_REQUIRED_LIBRARIES "${OPENSSL_LIBRARIES}")
818
+ if(HAVE_LIBZ)
819
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "${ZLIB_LIBRARIES}")
820
+ endif()
821
+ if(WIN32)
822
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "ws2_32")
823
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "bcrypt") # for OpenSSL/LibreSSL
824
+ endif()
825
+ elseif(USE_WOLFSSL)
826
+ set(CMAKE_REQUIRED_INCLUDES "${WOLFSSL_INCLUDE_DIRS}")
827
+ set(CMAKE_REQUIRED_LIBRARIES "${WOLFSSL_LIBRARIES}")
828
+ curl_required_libpaths("${WOLFSSL_LIBRARY_DIRS}")
829
+ if(HAVE_LIBZ)
830
+ list(APPEND CMAKE_REQUIRED_INCLUDES "${ZLIB_INCLUDE_DIRS}") # Public wolfSSL headers require zlib headers
831
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "${ZLIB_LIBRARIES}")
832
+ endif()
833
+ if(WIN32)
834
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "ws2_32" "crypt32")
835
+ endif()
836
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS "-DHAVE_UINTPTR_T") # to pull in stdint.h (as of wolfSSL v5.5.4)
837
+ endif()
838
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "${_extra_libs}")
839
+ check_symbol_exists("${_symbol}" "${_files}" "${_variable}")
840
+ cmake_pop_check_state()
841
+ endmacro()
842
+
843
+ # Ensure that the OpenSSL fork actually supports QUIC.
844
+ macro(openssl_check_quic)
845
+ if(NOT DEFINED HAVE_SSL_CTX_SET_QUIC_METHOD)
846
+ if(USE_OPENSSL)
847
+ openssl_check_symbol_exists("SSL_CTX_set_quic_method" "openssl/ssl.h" HAVE_SSL_CTX_SET_QUIC_METHOD "")
848
+ elseif(USE_WOLFSSL)
849
+ openssl_check_symbol_exists("wolfSSL_set_quic_method" "wolfssl/options.h;wolfssl/openssl/ssl.h"
850
+ HAVE_SSL_CTX_SET_QUIC_METHOD "")
851
+ endif()
852
+ endif()
853
+ if(NOT HAVE_SSL_CTX_SET_QUIC_METHOD)
854
+ message(FATAL_ERROR "QUIC support is missing in OpenSSL fork. Try setting -DOPENSSL_ROOT_DIR")
855
+ endif()
856
+ endmacro()
857
+
858
+ if(USE_WOLFSSL)
859
+ openssl_check_symbol_exists("wolfSSL_DES_ecb_encrypt" "wolfssl/options.h;wolfssl/openssl/des.h" HAVE_WOLFSSL_DES_ECB_ENCRYPT "")
860
+ openssl_check_symbol_exists("wolfSSL_BIO_new" "wolfssl/options.h;wolfssl/ssl.h" HAVE_WOLFSSL_BIO "")
861
+ openssl_check_symbol_exists("wolfSSL_BIO_set_shutdown" "wolfssl/options.h;wolfssl/ssl.h" HAVE_WOLFSSL_FULL_BIO "")
862
+ endif()
863
+
864
+ if(USE_OPENSSL OR USE_WOLFSSL)
865
+ if(NOT DEFINED HAVE_SSL_SET0_WBIO)
866
+ openssl_check_symbol_exists("SSL_set0_wbio" "openssl/ssl.h" HAVE_SSL_SET0_WBIO "")
867
+ endif()
868
+ if(NOT DEFINED HAVE_OPENSSL_SRP AND NOT CURL_DISABLE_SRP)
869
+ openssl_check_symbol_exists("SSL_CTX_set_srp_username" "openssl/ssl.h" HAVE_OPENSSL_SRP "")
870
+ endif()
871
+ endif()
872
+
873
+ option(USE_HTTPSRR "Enable HTTPS RR support" OFF)
874
+ option(USE_ECH "Enable ECH support" OFF)
875
+ if(USE_ECH)
876
+ if(USE_OPENSSL OR USE_WOLFSSL)
877
+ # Be sure that the TLS library actually supports ECH.
878
+ if(NOT DEFINED HAVE_ECH)
879
+ if(USE_OPENSSL AND (HAVE_BORINGSSL OR HAVE_AWSLC))
880
+ openssl_check_symbol_exists("SSL_set1_ech_config_list" "openssl/ssl.h" HAVE_ECH "")
881
+ elseif(USE_OPENSSL)
882
+ openssl_check_symbol_exists("SSL_ech_set1_echconfig" "openssl/ech.h" HAVE_ECH "")
883
+ elseif(USE_WOLFSSL)
884
+ openssl_check_symbol_exists("wolfSSL_CTX_GenerateEchConfig" "wolfssl/options.h;wolfssl/ssl.h" HAVE_ECH "")
885
+ endif()
886
+ endif()
887
+ if(NOT HAVE_ECH)
888
+ message(FATAL_ERROR "ECH support missing in OpenSSL/BoringSSL/AWS-LC/wolfSSL")
889
+ else()
890
+ message(STATUS "ECH enabled.")
891
+ endif()
892
+ else()
893
+ message(FATAL_ERROR "ECH requires ECH-enablded OpenSSL, BoringSSL, AWS-LC or wolfSSL")
894
+ endif()
895
+ endif()
896
+
897
+ option(USE_NGHTTP2 "Use nghttp2 library" ON)
898
+ if(USE_NGHTTP2)
899
+ find_package(NGHTTP2)
900
+ if(NGHTTP2_FOUND)
901
+ include_directories(SYSTEM ${NGHTTP2_INCLUDE_DIRS})
902
+ list(APPEND CURL_LIBS ${NGHTTP2_LIBRARIES})
903
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libnghttp2")
904
+ else()
905
+ set(USE_NGHTTP2 OFF)
906
+ endif()
907
+ endif()
908
+
909
+ option(USE_NGTCP2 "Use ngtcp2 and nghttp3 libraries for HTTP/3 support" OFF)
910
+ if(USE_NGTCP2)
911
+ if(USE_OPENSSL OR USE_WOLFSSL)
912
+ if(USE_WOLFSSL)
913
+ find_package(NGTCP2 REQUIRED "wolfSSL")
914
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libngtcp2_crypto_wolfssl")
915
+ elseif(HAVE_BORINGSSL OR HAVE_AWSLC)
916
+ find_package(NGTCP2 REQUIRED "BoringSSL")
917
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libngtcp2_crypto_boringssl")
918
+ else()
919
+ find_package(NGTCP2 REQUIRED "quictls")
920
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libngtcp2_crypto_quictls")
921
+ endif()
922
+ openssl_check_quic()
923
+ elseif(USE_GNUTLS)
924
+ find_package(NGTCP2 REQUIRED "GnuTLS")
925
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libngtcp2_crypto_gnutls")
926
+ else()
927
+ message(FATAL_ERROR "ngtcp2 requires OpenSSL, wolfSSL or GnuTLS")
928
+ endif()
929
+ include_directories(SYSTEM ${NGTCP2_INCLUDE_DIRS})
930
+ list(APPEND CURL_LIBS ${NGTCP2_LIBRARIES})
931
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libngtcp2")
932
+
933
+ find_package(NGHTTP3 REQUIRED)
934
+ set(USE_NGHTTP3 ON)
935
+ include_directories(SYSTEM ${NGHTTP3_INCLUDE_DIRS})
936
+ list(APPEND CURL_LIBS ${NGHTTP3_LIBRARIES})
937
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libnghttp3")
938
+ endif()
939
+
940
+ option(USE_QUICHE "Use quiche library for HTTP/3 support" OFF)
941
+ if(USE_QUICHE)
942
+ if(USE_NGTCP2)
943
+ message(FATAL_ERROR "Only one HTTP/3 backend can be selected")
944
+ endif()
945
+ find_package(Quiche REQUIRED)
946
+ if(NOT HAVE_BORINGSSL)
947
+ message(FATAL_ERROR "quiche requires BoringSSL")
948
+ endif()
949
+ openssl_check_quic()
950
+ list(APPEND CURL_LIBS ${QUICHE_LIBRARIES})
951
+ list(APPEND CURL_LIBDIRS ${QUICHE_LIBRARY_DIRS})
952
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "quiche")
953
+ include_directories(SYSTEM ${QUICHE_INCLUDE_DIRS})
954
+ link_directories(${QUICHE_LIBRARY_DIRS})
955
+ if(QUICHE_CFLAGS)
956
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${QUICHE_CFLAGS}")
957
+ endif()
958
+ if(NOT DEFINED HAVE_QUICHE_CONN_SET_QLOG_FD)
959
+ cmake_push_check_state()
960
+ set(CMAKE_REQUIRED_INCLUDES "${QUICHE_INCLUDE_DIRS}")
961
+ set(CMAKE_REQUIRED_LIBRARIES "${QUICHE_LIBRARIES}")
962
+ check_symbol_exists("quiche_conn_set_qlog_fd" "quiche.h" HAVE_QUICHE_CONN_SET_QLOG_FD)
963
+ cmake_pop_check_state()
964
+ endif()
965
+ endif()
966
+
967
+ option(USE_MSH3 "Use msh3/msquic library for HTTP/3 support" OFF)
968
+ if(USE_MSH3)
969
+ if(USE_NGTCP2 OR USE_QUICHE)
970
+ message(FATAL_ERROR "Only one HTTP/3 backend can be selected")
971
+ endif()
972
+ if(NOT WIN32)
973
+ if(NOT USE_OPENSSL)
974
+ message(FATAL_ERROR "msh3/msquic requires OpenSSL fork with QUIC API")
975
+ endif()
976
+ openssl_check_quic()
977
+ endif()
978
+ find_package(MSH3 REQUIRED)
979
+ list(APPEND CURL_LIBS ${MSH3_LIBRARIES})
980
+ list(APPEND CURL_LIBDIRS ${MSH3_LIBRARY_DIRS})
981
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${MSH3_PC_REQUIRES})
982
+ include_directories(SYSTEM ${MSH3_INCLUDE_DIRS})
983
+ link_directories(${MSH3_LIBRARY_DIRS})
984
+ if(MSH3_CFLAGS)
985
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MSH3_CFLAGS}")
986
+ endif()
987
+ endif()
988
+
989
+ if(USE_OPENSSL_QUIC)
990
+ if(USE_NGTCP2 OR USE_QUICHE OR USE_MSH3)
991
+ message(FATAL_ERROR "Only one HTTP/3 backend can be selected")
992
+ endif()
993
+ find_package(OpenSSL 3.3.0 REQUIRED)
994
+
995
+ find_package(NGHTTP3 REQUIRED)
996
+ set(USE_NGHTTP3 ON)
997
+ include_directories(SYSTEM ${NGHTTP3_INCLUDE_DIRS})
998
+ list(APPEND CURL_LIBS ${NGHTTP3_LIBRARIES})
999
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libnghttp3")
1000
+ endif()
1001
+
1002
+ if(CURL_WITH_MULTI_SSL AND (USE_NGTCP2 OR USE_QUICHE OR USE_MSH3 OR USE_OPENSSL_QUIC))
1003
+ message(FATAL_ERROR "MultiSSL cannot be enabled with HTTP/3 and vice versa.")
1004
+ endif()
1005
+
1006
+ if(NOT CURL_DISABLE_SRP AND (HAVE_GNUTLS_SRP OR HAVE_OPENSSL_SRP))
1007
+ set(USE_TLS_SRP 1)
1008
+ endif()
1009
+
1010
+ if(NOT CURL_DISABLE_LDAP)
1011
+ if(WIN32 AND NOT WINDOWS_STORE)
1012
+ option(USE_WIN32_LDAP "Use Windows LDAP implementation" ON)
1013
+ if(USE_WIN32_LDAP)
1014
+ list(APPEND CURL_LIBS "wldap32")
1015
+ if(NOT CURL_DISABLE_LDAPS)
1016
+ set(HAVE_LDAP_SSL ON)
1017
+ endif()
1018
+ endif()
1019
+ endif()
1020
+
1021
+ # Now that we know, we are not using Windows LDAP...
1022
+ if(NOT USE_WIN32_LDAP)
1023
+ if(NOT DEFINED LDAP_LIBRARY)
1024
+ set(LDAP_LIBRARY "ldap" CACHE STRING "Name or full path to ldap library")
1025
+ endif()
1026
+ if(NOT DEFINED LDAP_LBER_LIBRARY)
1027
+ set(LDAP_LBER_LIBRARY "lber" CACHE STRING "Name or full path to lber library")
1028
+ endif()
1029
+ if(NOT DEFINED LDAP_INCLUDE_DIR)
1030
+ set(LDAP_INCLUDE_DIR "" CACHE STRING "Path to LDAP include directory")
1031
+ endif()
1032
+
1033
+ # Check for LDAP
1034
+ cmake_push_check_state()
1035
+ if(USE_OPENSSL)
1036
+ set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES})
1037
+ endif()
1038
+ check_library_exists("${LDAP_LIBRARY}" "ldap_init" "" HAVE_LIBLDAP)
1039
+ if(HAVE_LIBLDAP)
1040
+ check_library_exists("${LDAP_LIBRARY};${LDAP_LBER_LIBRARY}" "ber_init" "" HAVE_LIBLBER)
1041
+ else()
1042
+ check_library_exists("${LDAP_LBER_LIBRARY}" "ber_init" "" HAVE_LIBLBER)
1043
+ endif()
1044
+
1045
+ if(LDAP_INCLUDE_DIR)
1046
+ list(APPEND CMAKE_REQUIRED_INCLUDES ${LDAP_INCLUDE_DIR})
1047
+ endif()
1048
+
1049
+ unset(_include_list)
1050
+ check_include_file("lber.h" HAVE_LBER_H)
1051
+ if(HAVE_LBER_H)
1052
+ list(APPEND _include_list "lber.h")
1053
+ endif()
1054
+ check_include_files("${_include_list};ldap.h" HAVE_LDAP_H)
1055
+ unset(_include_list)
1056
+
1057
+ if(NOT HAVE_LDAP_H)
1058
+ message(STATUS "LDAP_H not found CURL_DISABLE_LDAP set ON")
1059
+ set(CURL_DISABLE_LDAP ON CACHE BOOL "" FORCE)
1060
+ elseif(NOT HAVE_LIBLDAP)
1061
+ message(STATUS "LDAP library '${LDAP_LIBRARY}' not found CURL_DISABLE_LDAP set ON")
1062
+ set(CURL_DISABLE_LDAP ON CACHE BOOL "" FORCE)
1063
+ else()
1064
+ if(LDAP_INCLUDE_DIR)
1065
+ include_directories(SYSTEM ${LDAP_INCLUDE_DIR})
1066
+ endif()
1067
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS "-DLDAP_DEPRECATED=1")
1068
+ list(APPEND CMAKE_REQUIRED_LIBRARIES ${LDAP_LIBRARY})
1069
+ set(CURL_LIBS "${LDAP_LIBRARY};${CURL_LIBS}")
1070
+ # FIXME: uncomment once pkg-config-based detection landed: https://github.com/curl/curl/pull/15273
1071
+ # set(LIBCURL_PC_REQUIRES_PRIVATE "${LDAP_PC_REQUIRES};${LIBCURL_PC_REQUIRES_PRIVATE}")
1072
+ if(HAVE_LIBLBER)
1073
+ list(APPEND CMAKE_REQUIRED_LIBRARIES ${LDAP_LBER_LIBRARY})
1074
+ set(CURL_LIBS "${LDAP_LBER_LIBRARY};${CURL_LIBS}")
1075
+ endif()
1076
+
1077
+ check_function_exists("ldap_url_parse" HAVE_LDAP_URL_PARSE)
1078
+ check_function_exists("ldap_init_fd" HAVE_LDAP_INIT_FD)
1079
+
1080
+ check_include_file("ldap_ssl.h" HAVE_LDAP_SSL_H)
1081
+
1082
+ if(HAVE_LDAP_INIT_FD)
1083
+ set(USE_OPENLDAP ON)
1084
+ add_definitions("-DLDAP_DEPRECATED=1")
1085
+ endif()
1086
+ if(NOT CURL_DISABLE_LDAPS)
1087
+ set(HAVE_LDAP_SSL ON)
1088
+ endif()
1089
+ endif()
1090
+ cmake_pop_check_state()
1091
+ endif()
1092
+ endif()
1093
+
1094
+ # No ldap, no ldaps.
1095
+ if(CURL_DISABLE_LDAP)
1096
+ if(NOT CURL_DISABLE_LDAPS)
1097
+ message(STATUS "LDAP needs to be enabled to support LDAPS")
1098
+ set(CURL_DISABLE_LDAPS ON CACHE BOOL "" FORCE)
1099
+ endif()
1100
+ endif()
1101
+
1102
+ if(WIN32)
1103
+ option(USE_WIN32_IDN "Use WinIDN for IDN support" OFF)
1104
+ if(USE_WIN32_IDN)
1105
+ list(APPEND CURL_LIBS "normaliz")
1106
+ endif()
1107
+ else()
1108
+ set(USE_WIN32_IDN OFF)
1109
+ endif()
1110
+
1111
+ if(APPLE)
1112
+ option(USE_APPLE_IDN "Use Apple built-in IDN support" OFF)
1113
+ if(USE_APPLE_IDN)
1114
+ cmake_push_check_state()
1115
+ set(CMAKE_REQUIRED_LIBRARIES "icucore")
1116
+ check_symbol_exists("uidna_openUTS46" "unicode/uidna.h" HAVE_APPLE_IDN)
1117
+ cmake_pop_check_state()
1118
+ if(HAVE_APPLE_IDN)
1119
+ list(APPEND CURL_LIBS "icucore" "iconv")
1120
+ else()
1121
+ set(USE_APPLE_IDN OFF)
1122
+ endif()
1123
+ endif()
1124
+ else()
1125
+ set(USE_APPLE_IDN OFF)
1126
+ endif()
1127
+
1128
+ # Check for libidn2
1129
+ option(USE_LIBIDN2 "Use libidn2 for IDN support" ON)
1130
+ set(HAVE_IDN2_H OFF)
1131
+ set(HAVE_LIBIDN2 OFF)
1132
+ if(USE_LIBIDN2 AND NOT USE_APPLE_IDN AND NOT USE_WIN32_IDN)
1133
+ find_package(Libidn2)
1134
+ if(LIBIDN2_FOUND)
1135
+ set(CURL_LIBS "${LIBIDN2_LIBRARIES};${CURL_LIBS}")
1136
+ list(APPEND CURL_LIBDIRS ${LIBIDN2_LIBRARY_DIRS})
1137
+ set(LIBCURL_PC_REQUIRES_PRIVATE "libidn2;${LIBCURL_PC_REQUIRES_PRIVATE}")
1138
+ include_directories(SYSTEM ${LIBIDN2_INCLUDE_DIRS})
1139
+ link_directories(${LIBIDN2_LIBRARY_DIRS})
1140
+ if(LIBIDN2_CFLAGS)
1141
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBIDN2_CFLAGS}")
1142
+ endif()
1143
+ set(HAVE_IDN2_H 1)
1144
+ set(HAVE_LIBIDN2 1)
1145
+ endif()
1146
+ endif()
1147
+
1148
+ # libpsl
1149
+ option(CURL_USE_LIBPSL "Use libpsl" ON)
1150
+ mark_as_advanced(CURL_USE_LIBPSL)
1151
+ set(USE_LIBPSL OFF)
1152
+
1153
+ if(CURL_USE_LIBPSL)
1154
+ find_package(Libpsl) # TODO: add REQUIRED to match autotools
1155
+ if(LIBPSL_FOUND)
1156
+ list(APPEND CURL_LIBS ${LIBPSL_LIBRARIES})
1157
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libpsl")
1158
+ include_directories(SYSTEM ${LIBPSL_INCLUDE_DIRS})
1159
+ set(USE_LIBPSL ON)
1160
+ else()
1161
+ message(WARNING "libpsl is enabled, but not found.")
1162
+ endif()
1163
+ endif()
1164
+
1165
+ # libssh2
1166
+ option(CURL_USE_LIBSSH2 "Use libssh2" ON)
1167
+ mark_as_advanced(CURL_USE_LIBSSH2)
1168
+ set(USE_LIBSSH2 OFF)
1169
+
1170
+ if(CURL_USE_LIBSSH2)
1171
+ find_package(Libssh2)
1172
+ if(LIBSSH2_FOUND)
1173
+ list(APPEND CURL_LIBS ${LIBSSH2_LIBRARIES})
1174
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libssh2")
1175
+ include_directories(SYSTEM ${LIBSSH2_INCLUDE_DIRS})
1176
+ set(USE_LIBSSH2 ON)
1177
+ endif()
1178
+ endif()
1179
+
1180
+ # libssh
1181
+ option(CURL_USE_LIBSSH "Use libssh" OFF)
1182
+ mark_as_advanced(CURL_USE_LIBSSH)
1183
+ if(NOT USE_LIBSSH2 AND CURL_USE_LIBSSH)
1184
+ find_package(Libssh REQUIRED)
1185
+ if(LIBSSH_FOUND)
1186
+ list(APPEND CURL_LIBS ${LIBSSH_LIBRARIES})
1187
+ list(APPEND CURL_LIBDIRS ${LIBSSH_LIBRARY_DIRS})
1188
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libssh")
1189
+ include_directories(SYSTEM ${LIBSSH_INCLUDE_DIRS})
1190
+ link_directories(${LIBSSH_LIBRARY_DIRS})
1191
+ if(LIBSSH_CFLAGS)
1192
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBSSH_CFLAGS}")
1193
+ endif()
1194
+ set(USE_LIBSSH ON)
1195
+ endif()
1196
+ endif()
1197
+
1198
+ # wolfSSH
1199
+ option(CURL_USE_WOLFSSH "Use wolfSSH" OFF)
1200
+ mark_as_advanced(CURL_USE_WOLFSSH)
1201
+ set(USE_WOLFSSH OFF)
1202
+ if(NOT USE_LIBSSH2 AND NOT USE_LIBSSH AND CURL_USE_WOLFSSH)
1203
+ if(USE_WOLFSSL)
1204
+ find_package(WolfSSH)
1205
+ if(WOLFSSH_FOUND)
1206
+ list(APPEND CURL_LIBS ${WOLFSSH_LIBRARIES})
1207
+ include_directories(SYSTEM ${WOLFSSH_INCLUDE_DIRS})
1208
+ set(USE_WOLFSSH ON)
1209
+ endif()
1210
+ else()
1211
+ message(WARNING "wolfSSH requires wolfSSL. Skipping.")
1212
+ endif()
1213
+ endif()
1214
+
1215
+ option(CURL_USE_GSASL "Use libgsasl" OFF)
1216
+ mark_as_advanced(CURL_USE_GSASL)
1217
+ if(CURL_USE_GSASL)
1218
+ find_package(Libgsasl REQUIRED)
1219
+ if(LIBGSASL_FOUND)
1220
+ list(APPEND CURL_LIBS ${LIBGSASL_LIBRARIES})
1221
+ list(APPEND CURL_LIBDIRS ${LIBGSASL_LIBRARY_DIRS})
1222
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libgsasl")
1223
+ include_directories(SYSTEM ${LIBGSASL_INCLUDE_DIRS})
1224
+ link_directories(${LIBGSASL_LIBRARY_DIRS})
1225
+ if(LIBGSASL_CFLAGS)
1226
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBGSASL_CFLAGS}")
1227
+ endif()
1228
+ set(USE_GSASL ON)
1229
+ endif()
1230
+ endif()
1231
+
1232
+ option(CURL_USE_GSSAPI "Use GSSAPI implementation" OFF)
1233
+ mark_as_advanced(CURL_USE_GSSAPI)
1234
+
1235
+ if(CURL_USE_GSSAPI)
1236
+ find_package(GSS)
1237
+
1238
+ set(HAVE_GSSAPI ${GSS_FOUND})
1239
+ if(GSS_FOUND)
1240
+ if(GSS_FLAVOUR STREQUAL "GNU")
1241
+ set(HAVE_GSSGNU 1)
1242
+ else()
1243
+ cmake_push_check_state()
1244
+ list(APPEND CMAKE_REQUIRED_INCLUDES ${GSS_INCLUDE_DIRS})
1245
+
1246
+ set(_include_list "")
1247
+ check_include_file("gssapi/gssapi.h" HAVE_GSSAPI_GSSAPI_H)
1248
+ if(HAVE_GSSAPI_GSSAPI_H)
1249
+ list(APPEND _include_list "gssapi/gssapi.h")
1250
+ endif()
1251
+ check_include_files("${_include_list};gssapi/gssapi_generic.h" HAVE_GSSAPI_GSSAPI_GENERIC_H)
1252
+
1253
+ if(GSS_FLAVOUR STREQUAL "MIT")
1254
+ check_include_files("${_include_list};gssapi/gssapi_krb5.h" _have_gssapi_gssapi_krb5_h)
1255
+ if(HAVE_GSSAPI_GSSAPI_GENERIC_H)
1256
+ list(APPEND _include_list "gssapi/gssapi_generic.h")
1257
+ endif()
1258
+ if(_have_gssapi_gssapi_krb5_h)
1259
+ list(APPEND _include_list "gssapi/gssapi_krb5.h")
1260
+ endif()
1261
+
1262
+ if(NOT DEFINED HAVE_GSS_C_NT_HOSTBASED_SERVICE)
1263
+ set(CMAKE_REQUIRED_FLAGS ${GSS_CFLAGS})
1264
+ set(CMAKE_REQUIRED_LIBRARIES ${GSS_LIBRARIES})
1265
+ curl_required_libpaths("${GSS_LIBRARY_DIRS}")
1266
+ check_symbol_exists("GSS_C_NT_HOSTBASED_SERVICE" "${_include_list}" HAVE_GSS_C_NT_HOSTBASED_SERVICE)
1267
+ endif()
1268
+ if(NOT HAVE_GSS_C_NT_HOSTBASED_SERVICE)
1269
+ set(HAVE_OLD_GSSMIT ON)
1270
+ endif()
1271
+ endif()
1272
+ unset(_include_list)
1273
+ cmake_pop_check_state()
1274
+ endif()
1275
+
1276
+ list(APPEND CURL_LIBS ${GSS_LIBRARIES})
1277
+ list(APPEND CURL_LIBDIRS ${GSS_LIBRARY_DIRS})
1278
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${GSS_PC_REQUIRES})
1279
+ include_directories(SYSTEM ${GSS_INCLUDE_DIRS})
1280
+ link_directories(${GSS_LIBRARY_DIRS})
1281
+ if(GSS_CFLAGS)
1282
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GSS_CFLAGS}")
1283
+ endif()
1284
+ else()
1285
+ message(WARNING "GSSAPI has been requested, but no supporting libraries found. Skipping.")
1286
+ endif()
1287
+ endif()
1288
+
1289
+ # libuv
1290
+ option(CURL_USE_LIBUV "Use libuv for event-based tests" OFF)
1291
+ if(CURL_USE_LIBUV)
1292
+ if(NOT ENABLE_DEBUG)
1293
+ message(FATAL_ERROR "Using libuv without debug support enabled is useless")
1294
+ endif()
1295
+ find_package(Libuv REQUIRED)
1296
+ if(LIBUV_FOUND)
1297
+ list(APPEND CURL_LIBS ${LIBUV_LIBRARIES})
1298
+ list(APPEND CURL_LIBDIRS ${LIBUV_LIBRARY_DIRS})
1299
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libuv")
1300
+ include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS})
1301
+ link_directories(${LIBUV_LIBRARY_DIRS})
1302
+ if(LIBUV_CFLAGS)
1303
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUV_CFLAGS}")
1304
+ endif()
1305
+ set(USE_LIBUV ON)
1306
+ set(HAVE_UV_H ON)
1307
+ endif()
1308
+ endif()
1309
+
1310
+ option(USE_LIBRTMP "Enable librtmp from rtmpdump" OFF)
1311
+ if(USE_LIBRTMP)
1312
+ set(_extra_libs "rtmp")
1313
+ if(WIN32)
1314
+ list(APPEND _extra_libs "winmm")
1315
+ endif()
1316
+ openssl_check_symbol_exists("RTMP_Init" "librtmp/rtmp.h" HAVE_LIBRTMP "${_extra_libs}")
1317
+ if(HAVE_LIBRTMP)
1318
+ list(APPEND CURL_LIBS "rtmp")
1319
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "librtmp")
1320
+ if(WIN32)
1321
+ list(APPEND CURL_LIBS "winmm")
1322
+ endif()
1323
+ else()
1324
+ message(WARNING "librtmp has been requested, but not found or missing OpenSSL. Skipping.")
1325
+ set(USE_LIBRTMP OFF)
1326
+ endif()
1327
+ endif()
1328
+
1329
+ option(ENABLE_UNIX_SOCKETS "Enable Unix domain sockets support" ON)
1330
+ if(ENABLE_UNIX_SOCKETS)
1331
+ if(WIN32)
1332
+ set(USE_UNIX_SOCKETS ON)
1333
+ else()
1334
+ include(CheckStructHasMember)
1335
+ check_struct_has_member("struct sockaddr_un" "sun_path" "sys/un.h" USE_UNIX_SOCKETS)
1336
+ endif()
1337
+ else()
1338
+ unset(USE_UNIX_SOCKETS CACHE)
1339
+ endif()
1340
+
1341
+ #
1342
+ # CA handling
1343
+ #
1344
+ if(_curl_ca_bundle_supported)
1345
+ set(CURL_CA_BUNDLE "auto" CACHE
1346
+ STRING "Path to the CA bundle. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
1347
+ set(CURL_CA_FALLBACK OFF CACHE BOOL
1348
+ "Use built-in CA store of TLS backend. Defaults to OFF")
1349
+ set(CURL_CA_PATH "auto" CACHE
1350
+ STRING "Location of default CA path. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
1351
+ set(CURL_CA_EMBED "" CACHE
1352
+ STRING "Path to the CA bundle to embed in the curl tool.")
1353
+
1354
+ if(CURL_CA_BUNDLE STREQUAL "")
1355
+ message(FATAL_ERROR "Invalid value of CURL_CA_BUNDLE. Use 'none', 'auto' or file path.")
1356
+ elseif(CURL_CA_BUNDLE STREQUAL "none")
1357
+ unset(CURL_CA_BUNDLE CACHE)
1358
+ elseif(CURL_CA_BUNDLE STREQUAL "auto")
1359
+ unset(CURL_CA_BUNDLE CACHE)
1360
+ if(NOT CMAKE_CROSSCOMPILING AND NOT WIN32)
1361
+ set(_curl_ca_bundle_autodetect TRUE)
1362
+ endif()
1363
+ else()
1364
+ set(CURL_CA_BUNDLE_SET TRUE)
1365
+ endif()
1366
+ mark_as_advanced(CURL_CA_BUNDLE_SET)
1367
+
1368
+ if(CURL_CA_PATH STREQUAL "")
1369
+ message(FATAL_ERROR "Invalid value of CURL_CA_PATH. Use 'none', 'auto' or directory path.")
1370
+ elseif(CURL_CA_PATH STREQUAL "none")
1371
+ unset(CURL_CA_PATH CACHE)
1372
+ elseif(CURL_CA_PATH STREQUAL "auto")
1373
+ unset(CURL_CA_PATH CACHE)
1374
+ if(NOT CMAKE_CROSSCOMPILING AND NOT WIN32)
1375
+ set(_curl_ca_path_autodetect TRUE)
1376
+ endif()
1377
+ else()
1378
+ set(CURL_CA_PATH_SET TRUE)
1379
+ endif()
1380
+ mark_as_advanced(CURL_CA_PATH_SET)
1381
+
1382
+ if(CURL_CA_BUNDLE_SET AND _curl_ca_path_autodetect)
1383
+ # Skip auto-detection of unset CA path because CA bundle is set explicitly
1384
+ elseif(CURL_CA_PATH_SET AND _curl_ca_bundle_autodetect)
1385
+ # Skip auto-detection of unset CA bundle because CA path is set explicitly
1386
+ elseif(_curl_ca_bundle_autodetect OR _curl_ca_path_autodetect)
1387
+ # First try auto-detecting a CA bundle, then a CA path
1388
+
1389
+ if(_curl_ca_bundle_autodetect)
1390
+ foreach(_search_ca_bundle_path IN ITEMS
1391
+ "/etc/ssl/certs/ca-certificates.crt"
1392
+ "/etc/pki/tls/certs/ca-bundle.crt"
1393
+ "/usr/share/ssl/certs/ca-bundle.crt"
1394
+ "/usr/local/share/certs/ca-root-nss.crt"
1395
+ "/etc/ssl/cert.pem")
1396
+ if(EXISTS "${_search_ca_bundle_path}")
1397
+ message(STATUS "Found CA bundle: ${_search_ca_bundle_path}")
1398
+ set(CURL_CA_BUNDLE "${_search_ca_bundle_path}" CACHE
1399
+ STRING "Path to the CA bundle. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
1400
+ set(CURL_CA_BUNDLE_SET TRUE CACHE BOOL "Path to the CA bundle has been set")
1401
+ break()
1402
+ endif()
1403
+ endforeach()
1404
+ endif()
1405
+
1406
+ if(_curl_ca_path_autodetect AND NOT CURL_CA_PATH_SET)
1407
+ set(_search_ca_path "/etc/ssl/certs")
1408
+ file(GLOB _curl_ca_files_found "${_search_ca_path}/[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f].0")
1409
+ if(_curl_ca_files_found)
1410
+ unset(_curl_ca_files_found)
1411
+ message(STATUS "Found CA path: ${_search_ca_path}")
1412
+ set(CURL_CA_PATH "${_search_ca_path}" CACHE
1413
+ STRING "Location of default CA path. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
1414
+ set(CURL_CA_PATH_SET TRUE CACHE BOOL "Path to the CA bundle has been set")
1415
+ endif()
1416
+ endif()
1417
+ endif()
1418
+
1419
+ set(CURL_CA_EMBED_SET FALSE)
1420
+ if(BUILD_CURL_EXE AND NOT CURL_CA_EMBED STREQUAL "")
1421
+ if(EXISTS "${CURL_CA_EMBED}")
1422
+ set(CURL_CA_EMBED_SET TRUE)
1423
+ message(STATUS "Found CA bundle to embed: ${CURL_CA_EMBED}")
1424
+ else()
1425
+ message(FATAL_ERROR "CA bundle to embed is missing: '${CURL_CA_EMBED}'")
1426
+ endif()
1427
+ endif()
1428
+ endif()
1429
+
1430
+ if(WIN32)
1431
+ option(CURL_DISABLE_CA_SEARCH "Disable unsafe CA bundle search in PATH on Windows" OFF)
1432
+ option(CURL_CA_SEARCH_SAFE "Enable safe CA bundle search (within the curl tool directory) on Windows" OFF)
1433
+ endif()
1434
+
1435
+ # Check for header files
1436
+ if(WIN32)
1437
+ list(APPEND CURL_INCLUDES "winsock2.h")
1438
+ list(APPEND CURL_INCLUDES "ws2tcpip.h")
1439
+
1440
+ if(HAVE_WIN32_WINNT)
1441
+ if(HAVE_WIN32_WINNT LESS 0x0501)
1442
+ # Windows XP is required for freeaddrinfo, getaddrinfo
1443
+ message(FATAL_ERROR "Building for Windows XP or newer is required.")
1444
+ endif()
1445
+
1446
+ # Pre-fill detection results based on target OS version
1447
+ if(MINGW OR MSVC)
1448
+ if(HAVE_WIN32_WINNT LESS 0x0600)
1449
+ set(HAVE_INET_NTOP 0)
1450
+ set(HAVE_INET_PTON 0)
1451
+ else() # Windows Vista or newer
1452
+ set(HAVE_INET_NTOP 1)
1453
+ set(HAVE_INET_PTON 1)
1454
+ endif()
1455
+ unset(HAVE_INET_NTOP CACHE)
1456
+ unset(HAVE_INET_PTON CACHE)
1457
+ endif()
1458
+ endif()
1459
+ endif()
1460
+
1461
+ # Detect headers
1462
+
1463
+ # Use check_include_file_concat() for headers required by subsequent
1464
+ # check_include_file_concat() or check_symbol_exists() detections.
1465
+ # Order for these is significant.
1466
+ check_include_file("sys/eventfd.h" HAVE_SYS_EVENTFD_H)
1467
+ check_include_file("sys/filio.h" HAVE_SYS_FILIO_H)
1468
+ check_include_file("sys/wait.h" HAVE_SYS_WAIT_H)
1469
+ check_include_file("sys/ioctl.h" HAVE_SYS_IOCTL_H)
1470
+ check_include_file("sys/param.h" HAVE_SYS_PARAM_H)
1471
+ check_include_file("sys/poll.h" HAVE_SYS_POLL_H)
1472
+ check_include_file("sys/resource.h" HAVE_SYS_RESOURCE_H)
1473
+ check_include_file_concat("sys/select.h" HAVE_SYS_SELECT_H)
1474
+ check_include_file_concat("sys/socket.h" HAVE_SYS_SOCKET_H)
1475
+ check_include_file("sys/sockio.h" HAVE_SYS_SOCKIO_H)
1476
+ check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
1477
+ check_include_file_concat("sys/time.h" HAVE_SYS_TIME_H)
1478
+ check_include_file_concat("sys/types.h" HAVE_SYS_TYPES_H)
1479
+ check_include_file("sys/un.h" HAVE_SYS_UN_H)
1480
+ check_include_file("sys/utime.h" HAVE_SYS_UTIME_H)
1481
+ check_include_file("sys/xattr.h" HAVE_SYS_XATTR_H)
1482
+
1483
+ check_include_file_concat("arpa/inet.h" HAVE_ARPA_INET_H)
1484
+ check_include_file("dirent.h" HAVE_DIRENT_H)
1485
+ check_include_file("fcntl.h" HAVE_FCNTL_H)
1486
+ check_include_file_concat("ifaddrs.h" HAVE_IFADDRS_H)
1487
+ check_include_file("io.h" HAVE_IO_H)
1488
+ check_include_file_concat("libgen.h" HAVE_LIBGEN_H)
1489
+ check_include_file("linux/tcp.h" HAVE_LINUX_TCP_H)
1490
+ check_include_file("locale.h" HAVE_LOCALE_H)
1491
+ check_include_file("net/if.h" HAVE_NET_IF_H)
1492
+ check_include_file_concat("netdb.h" HAVE_NETDB_H)
1493
+ check_include_file_concat("netinet/in.h" HAVE_NETINET_IN_H)
1494
+ check_include_file("netinet/in6.h" HAVE_NETINET_IN6_H)
1495
+ check_include_file_concat("netinet/tcp.h" HAVE_NETINET_TCP_H) # sys/types.h (e.g. Cygwin) netinet/in.h
1496
+ check_include_file_concat("netinet/udp.h" HAVE_NETINET_UDP_H) # sys/types.h (e.g. Cygwin)
1497
+ check_include_file("poll.h" HAVE_POLL_H)
1498
+ check_include_file("pwd.h" HAVE_PWD_H)
1499
+ check_include_file("stdatomic.h" HAVE_STDATOMIC_H)
1500
+ check_include_file("stdbool.h" HAVE_STDBOOL_H)
1501
+ check_include_file("strings.h" HAVE_STRINGS_H)
1502
+ check_include_file("stropts.h" HAVE_STROPTS_H)
1503
+ check_include_file("termio.h" HAVE_TERMIO_H)
1504
+ check_include_file("termios.h" HAVE_TERMIOS_H)
1505
+ check_include_file_concat("unistd.h" HAVE_UNISTD_H)
1506
+ check_include_file("utime.h" HAVE_UTIME_H)
1507
+
1508
+ if(CMAKE_SYSTEM_NAME MATCHES "AmigaOS")
1509
+ check_include_file_concat("proto/bsdsocket.h" HAVE_PROTO_BSDSOCKET_H)
1510
+ endif()
1511
+
1512
+ # Pass these detection results to curl_internal_test() for use in CurlTests.c
1513
+ # Add here all feature flags referenced from CurlTests.c
1514
+ foreach(_variable IN ITEMS
1515
+ HAVE_STDATOMIC_H
1516
+ HAVE_STDBOOL_H
1517
+ HAVE_STROPTS_H
1518
+ HAVE_SYS_IOCTL_H
1519
+ HAVE_SYS_SOCKET_H
1520
+ HAVE_SYS_TYPES_H
1521
+ HAVE_UNISTD_H
1522
+ )
1523
+ if(${_variable})
1524
+ set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -D${_variable}")
1525
+ endif()
1526
+ endforeach()
1527
+
1528
+ check_type_size("size_t" SIZEOF_SIZE_T)
1529
+ check_type_size("ssize_t" SIZEOF_SSIZE_T)
1530
+ check_type_size("long long" SIZEOF_LONG_LONG)
1531
+ check_type_size("long" SIZEOF_LONG)
1532
+ check_type_size("int" SIZEOF_INT)
1533
+ check_type_size("__int64" SIZEOF___INT64)
1534
+ check_type_size("time_t" SIZEOF_TIME_T)
1535
+ check_type_size("suseconds_t" SIZEOF_SUSECONDS_T)
1536
+ if(NOT HAVE_SIZEOF_SSIZE_T)
1537
+ if(SIZEOF_LONG EQUAL SIZEOF_SIZE_T)
1538
+ set(ssize_t "long")
1539
+ endif()
1540
+ if(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T)
1541
+ set(ssize_t "__int64")
1542
+ endif()
1543
+ endif()
1544
+ # off_t is sized later, after the HAVE_FILE_OFFSET_BITS test
1545
+
1546
+ if(SIZEOF_LONG_LONG)
1547
+ set(HAVE_LONGLONG 1)
1548
+ endif()
1549
+ if(SIZEOF_SUSECONDS_T)
1550
+ set(HAVE_SUSECONDS_T 1)
1551
+ endif()
1552
+
1553
+ # Check for some functions that are used
1554
+ if(WIN32)
1555
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "ws2_32") # Apply to all feature checks
1556
+ elseif(HAVE_LIBSOCKET)
1557
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "socket") # Apply to all feature checks
1558
+ endif()
1559
+
1560
+ check_function_exists("fnmatch" HAVE_FNMATCH)
1561
+ check_symbol_exists("basename" "${CURL_INCLUDES};string.h" HAVE_BASENAME) # libgen.h unistd.h
1562
+ check_symbol_exists("opendir" "dirent.h" HAVE_OPENDIR)
1563
+ check_function_exists("poll" HAVE_POLL) # poll.h
1564
+ check_symbol_exists("socket" "${CURL_INCLUDES}" HAVE_SOCKET) # winsock2.h sys/socket.h
1565
+ check_function_exists("sched_yield" HAVE_SCHED_YIELD)
1566
+ check_symbol_exists("socketpair" "${CURL_INCLUDES}" HAVE_SOCKETPAIR) # sys/socket.h
1567
+ check_symbol_exists("recv" "${CURL_INCLUDES}" HAVE_RECV) # proto/bsdsocket.h sys/types.h sys/socket.h
1568
+ check_symbol_exists("send" "${CURL_INCLUDES}" HAVE_SEND) # proto/bsdsocket.h sys/types.h sys/socket.h
1569
+ check_function_exists("sendmsg" HAVE_SENDMSG)
1570
+ check_function_exists("sendmmsg" HAVE_SENDMMSG)
1571
+ check_symbol_exists("select" "${CURL_INCLUDES}" HAVE_SELECT) # proto/bsdsocket.h sys/select.h sys/socket.h
1572
+ check_symbol_exists("strdup" "string.h" HAVE_STRDUP)
1573
+ check_symbol_exists("strtok_r" "string.h" HAVE_STRTOK_R)
1574
+ check_symbol_exists("strcasecmp" "string.h" HAVE_STRCASECMP)
1575
+ check_symbol_exists("stricmp" "string.h" HAVE_STRICMP)
1576
+ check_symbol_exists("strcmpi" "string.h" HAVE_STRCMPI)
1577
+ check_symbol_exists("memrchr" "string.h" HAVE_MEMRCHR)
1578
+ check_symbol_exists("alarm" "unistd.h" HAVE_ALARM)
1579
+ check_symbol_exists("fcntl" "fcntl.h" HAVE_FCNTL)
1580
+ check_function_exists("getppid" HAVE_GETPPID)
1581
+ check_function_exists("utimes" HAVE_UTIMES)
1582
+
1583
+ check_function_exists("gettimeofday" HAVE_GETTIMEOFDAY) # sys/time.h
1584
+ check_symbol_exists("closesocket" "${CURL_INCLUDES}" HAVE_CLOSESOCKET) # winsock2.h
1585
+ check_symbol_exists("sigsetjmp" "setjmp.h" HAVE_SIGSETJMP)
1586
+ check_function_exists("getpass_r" HAVE_GETPASS_R)
1587
+ check_function_exists("getpwuid" HAVE_GETPWUID)
1588
+ check_function_exists("getpwuid_r" HAVE_GETPWUID_R)
1589
+ check_function_exists("geteuid" HAVE_GETEUID)
1590
+ check_function_exists("utime" HAVE_UTIME)
1591
+ check_symbol_exists("gmtime_r" "stdlib.h;time.h" HAVE_GMTIME_R)
1592
+
1593
+ check_symbol_exists("gethostbyname_r" "netdb.h" HAVE_GETHOSTBYNAME_R)
1594
+
1595
+ check_symbol_exists("signal" "signal.h" HAVE_SIGNAL)
1596
+ check_symbol_exists("strtoll" "stdlib.h" HAVE_STRTOLL)
1597
+ check_symbol_exists("strerror_r" "stdlib.h;string.h" HAVE_STRERROR_R)
1598
+ check_symbol_exists("sigaction" "signal.h" HAVE_SIGACTION)
1599
+ check_symbol_exists("siginterrupt" "signal.h" HAVE_SIGINTERRUPT)
1600
+ check_symbol_exists("getaddrinfo" "${CURL_INCLUDES};stdlib.h;string.h" HAVE_GETADDRINFO) # ws2tcpip.h sys/socket.h netdb.h
1601
+ check_symbol_exists("getifaddrs" "${CURL_INCLUDES};stdlib.h" HAVE_GETIFADDRS) # ifaddrs.h
1602
+ check_symbol_exists("freeaddrinfo" "${CURL_INCLUDES}" HAVE_FREEADDRINFO) # ws2tcpip.h sys/socket.h netdb.h
1603
+ check_function_exists("pipe" HAVE_PIPE)
1604
+ check_function_exists("eventfd" HAVE_EVENTFD)
1605
+ check_symbol_exists("ftruncate" "unistd.h" HAVE_FTRUNCATE)
1606
+ check_symbol_exists("getpeername" "${CURL_INCLUDES}" HAVE_GETPEERNAME) # winsock2.h unistd.h proto/bsdsocket.h
1607
+ check_symbol_exists("getsockname" "${CURL_INCLUDES}" HAVE_GETSOCKNAME) # winsock2.h unistd.h proto/bsdsocket.h
1608
+ check_function_exists("if_nametoindex" HAVE_IF_NAMETOINDEX) # winsock2.h net/if.h
1609
+ check_function_exists("getrlimit" HAVE_GETRLIMIT)
1610
+ check_function_exists("setlocale" HAVE_SETLOCALE)
1611
+ check_function_exists("setmode" HAVE_SETMODE)
1612
+ check_function_exists("setrlimit" HAVE_SETRLIMIT)
1613
+
1614
+ if(WIN32 OR CYGWIN)
1615
+ check_function_exists("_setmode" HAVE__SETMODE)
1616
+ endif()
1617
+
1618
+ if(CMAKE_SYSTEM_NAME MATCHES "AmigaOS")
1619
+ check_symbol_exists("CloseSocket" "${CURL_INCLUDES}" HAVE_CLOSESOCKET_CAMEL) # sys/socket.h proto/bsdsocket.h
1620
+ endif()
1621
+
1622
+ if(NOT _ssl_enabled)
1623
+ check_symbol_exists("arc4random" "${CURL_INCLUDES};stdlib.h" HAVE_ARC4RANDOM)
1624
+ endif()
1625
+
1626
+ if(NOT MSVC OR (MSVC_VERSION GREATER_EQUAL 1900))
1627
+ # Earlier MSVC compilers had faulty snprintf implementations
1628
+ check_function_exists("snprintf" HAVE_SNPRINTF)
1629
+ endif()
1630
+ if(APPLE)
1631
+ check_function_exists("mach_absolute_time" HAVE_MACH_ABSOLUTE_TIME)
1632
+ endif()
1633
+ check_symbol_exists("inet_ntop" "${CURL_INCLUDES};stdlib.h;string.h" HAVE_INET_NTOP) # arpa/inet.h
1634
+ if(MSVC AND (MSVC_VERSION LESS_EQUAL 1600))
1635
+ set(HAVE_INET_NTOP OFF)
1636
+ endif()
1637
+ check_symbol_exists("inet_pton" "${CURL_INCLUDES};stdlib.h;string.h" HAVE_INET_PTON) # arpa/inet.h
1638
+
1639
+ check_symbol_exists("fsetxattr" "sys/xattr.h" HAVE_FSETXATTR)
1640
+ if(HAVE_FSETXATTR)
1641
+ curl_internal_test(HAVE_FSETXATTR_5)
1642
+ curl_internal_test(HAVE_FSETXATTR_6)
1643
+ endif()
1644
+
1645
+ cmake_push_check_state()
1646
+ if(WIN32)
1647
+ set(CMAKE_EXTRA_INCLUDE_FILES "winsock2.h")
1648
+ check_type_size("ADDRESS_FAMILY" SIZEOF_ADDRESS_FAMILY)
1649
+ set(HAVE_ADDRESS_FAMILY ${HAVE_SIZEOF_ADDRESS_FAMILY})
1650
+ elseif(HAVE_SYS_SOCKET_H)
1651
+ set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h")
1652
+ check_type_size("sa_family_t" SIZEOF_SA_FAMILY_T)
1653
+ set(HAVE_SA_FAMILY_T ${HAVE_SIZEOF_SA_FAMILY_T})
1654
+ endif()
1655
+ cmake_pop_check_state()
1656
+
1657
+ # Do curl specific tests
1658
+ foreach(_curl_test IN ITEMS
1659
+ HAVE_FCNTL_O_NONBLOCK
1660
+ HAVE_IOCTLSOCKET
1661
+ HAVE_IOCTLSOCKET_CAMEL
1662
+ HAVE_IOCTLSOCKET_CAMEL_FIONBIO
1663
+ HAVE_IOCTLSOCKET_FIONBIO
1664
+ HAVE_IOCTL_FIONBIO
1665
+ HAVE_IOCTL_SIOCGIFADDR
1666
+ HAVE_SETSOCKOPT_SO_NONBLOCK
1667
+ HAVE_O_NONBLOCK
1668
+ HAVE_GETHOSTBYNAME_R_3
1669
+ HAVE_GETHOSTBYNAME_R_5
1670
+ HAVE_GETHOSTBYNAME_R_6
1671
+ HAVE_GETHOSTBYNAME_R_3_REENTRANT
1672
+ HAVE_GETHOSTBYNAME_R_5_REENTRANT
1673
+ HAVE_GETHOSTBYNAME_R_6_REENTRANT
1674
+ HAVE_IN_ADDR_T
1675
+ HAVE_BOOL_T
1676
+ STDC_HEADERS
1677
+ HAVE_FILE_OFFSET_BITS
1678
+ HAVE_ATOMIC
1679
+ )
1680
+ curl_internal_test(${_curl_test})
1681
+ endforeach()
1682
+
1683
+ cmake_push_check_state()
1684
+ if(HAVE_FILE_OFFSET_BITS)
1685
+ set(_FILE_OFFSET_BITS 64)
1686
+ set(CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64")
1687
+ endif()
1688
+ check_type_size("off_t" SIZEOF_OFF_T)
1689
+
1690
+ # fseeko may not exist with _FILE_OFFSET_BITS=64 but can exist with
1691
+ # _FILE_OFFSET_BITS unset or 32 (e.g. Android ARMv7 with NDK 26b and API level < 24)
1692
+ # so we need to test fseeko after testing for _FILE_OFFSET_BITS
1693
+ check_symbol_exists("fseeko" "${CURL_INCLUDES};stdio.h" HAVE_FSEEKO)
1694
+
1695
+ if(HAVE_FSEEKO)
1696
+ set(HAVE_DECL_FSEEKO 1)
1697
+ endif()
1698
+
1699
+ # Include this header to get the type
1700
+ cmake_push_check_state()
1701
+ set(CMAKE_REQUIRED_INCLUDES "${PROJECT_SOURCE_DIR}/include")
1702
+ set(CMAKE_EXTRA_INCLUDE_FILES "curl/system.h")
1703
+ check_type_size("curl_off_t" SIZEOF_CURL_OFF_T)
1704
+ set(CMAKE_EXTRA_INCLUDE_FILES "curl/curl.h")
1705
+ check_type_size("curl_socket_t" SIZEOF_CURL_SOCKET_T)
1706
+ cmake_pop_check_state() # pop curl system headers
1707
+ cmake_pop_check_state() # pop -D_FILE_OFFSET_BITS=64
1708
+
1709
+ if(NOT WIN32 AND NOT CMAKE_CROSSCOMPILING)
1710
+ # On non-Windows and not cross-compiling, check for writable argv[]
1711
+ include(CheckCSourceRuns)
1712
+ check_c_source_runs("
1713
+ int main(int argc, char **argv)
1714
+ {
1715
+ (void)argc;
1716
+ argv[0][0] = ' ';
1717
+ return (argv[0][0] == ' ')?0:1;
1718
+ }" HAVE_WRITABLE_ARGV)
1719
+ endif()
1720
+
1721
+ curl_internal_test(HAVE_GLIBC_STRERROR_R)
1722
+ curl_internal_test(HAVE_POSIX_STRERROR_R)
1723
+
1724
+ # Check for reentrant
1725
+ foreach(_curl_test IN ITEMS
1726
+ HAVE_GETHOSTBYNAME_R_3
1727
+ HAVE_GETHOSTBYNAME_R_5
1728
+ HAVE_GETHOSTBYNAME_R_6)
1729
+ if(NOT ${_curl_test})
1730
+ if(${_curl_test}_REENTRANT)
1731
+ set(NEED_REENTRANT 1)
1732
+ endif()
1733
+ endif()
1734
+ endforeach()
1735
+
1736
+ if(NEED_REENTRANT)
1737
+ foreach(_curl_test IN ITEMS
1738
+ HAVE_GETHOSTBYNAME_R_3
1739
+ HAVE_GETHOSTBYNAME_R_5
1740
+ HAVE_GETHOSTBYNAME_R_6)
1741
+ set(${_curl_test} 0)
1742
+ if(${_curl_test}_REENTRANT)
1743
+ set(${_curl_test} 1)
1744
+ endif()
1745
+ endforeach()
1746
+ endif()
1747
+
1748
+ if(NOT WIN32)
1749
+ curl_internal_test(HAVE_CLOCK_GETTIME_MONOTONIC) # Check clock_gettime(CLOCK_MONOTONIC, x) support
1750
+ endif()
1751
+
1752
+ if(APPLE)
1753
+ curl_internal_test(HAVE_BUILTIN_AVAILABLE) # Check compiler support of __builtin_available()
1754
+ endif()
1755
+
1756
+ # Some other minor tests
1757
+
1758
+ if(NOT HAVE_IN_ADDR_T)
1759
+ set(in_addr_t "unsigned long")
1760
+ endif()
1761
+
1762
+ # Check for nonblocking
1763
+ set(HAVE_DISABLED_NONBLOCKING 1)
1764
+ if(HAVE_FIONBIO OR
1765
+ HAVE_IOCTLSOCKET OR
1766
+ HAVE_IOCTLSOCKET_CASE OR
1767
+ HAVE_O_NONBLOCK)
1768
+ unset(HAVE_DISABLED_NONBLOCKING)
1769
+ endif()
1770
+
1771
+ if(CMAKE_COMPILER_IS_GNUCC AND APPLE)
1772
+ include(CheckCCompilerFlag)
1773
+ check_c_compiler_flag("-Wno-long-double" HAVE_C_FLAG_Wno_long_double)
1774
+ if(HAVE_C_FLAG_Wno_long_double)
1775
+ # The Mac version of GCC warns about use of long double. Disable it.
1776
+ get_source_file_property(_mprintf_compile_flags "mprintf.c" COMPILE_FLAGS)
1777
+ if(_mprintf_compile_flags)
1778
+ set(_mprintf_compile_flags "${_mprintf_compile_flags} -Wno-long-double")
1779
+ else()
1780
+ set(_mprintf_compile_flags "-Wno-long-double")
1781
+ endif()
1782
+ set_source_files_properties("mprintf.c" PROPERTIES
1783
+ COMPILE_FLAGS ${_mprintf_compile_flags})
1784
+ endif()
1785
+ endif()
1786
+
1787
+ if(_cmake_try_compile_target_type_save)
1788
+ set(CMAKE_TRY_COMPILE_TARGET_TYPE ${_cmake_try_compile_target_type_save})
1789
+ unset(_cmake_try_compile_target_type_save)
1790
+ endif()
1791
+
1792
+ include(CMake/OtherTests.cmake)
1793
+
1794
+ add_definitions("-DHAVE_CONFIG_H")
1795
+
1796
+ # For Windows, all compilers used by CMake should support large files
1797
+ if(WIN32)
1798
+ set(USE_WIN32_LARGE_FILES ON)
1799
+
1800
+ # Use the manifest embedded in the Windows Resource
1801
+ set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -DCURL_EMBED_MANIFEST")
1802
+
1803
+ # We use crypto functions that are not available for UWP apps
1804
+ if(NOT WINDOWS_STORE)
1805
+ set(USE_WIN32_CRYPTO ON)
1806
+ endif()
1807
+
1808
+ # Link required libraries for USE_WIN32_CRYPTO or USE_SCHANNEL
1809
+ if(USE_WIN32_CRYPTO OR USE_SCHANNEL)
1810
+ list(APPEND CURL_LIBS "advapi32" "crypt32")
1811
+ endif()
1812
+ endif()
1813
+
1814
+ if(MSVC)
1815
+ # Disable default manifest added by CMake
1816
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")
1817
+
1818
+ add_definitions("-D_CRT_SECURE_NO_DEPRECATE" "-D_CRT_NONSTDC_NO_DEPRECATE")
1819
+ if(CMAKE_C_FLAGS MATCHES "/W[0-4]")
1820
+ string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
1821
+ else()
1822
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
1823
+ endif()
1824
+
1825
+ # Use multithreaded compilation on VS 2008+
1826
+ if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND MSVC_VERSION GREATER_EQUAL 1500)
1827
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
1828
+ endif()
1829
+ endif()
1830
+
1831
+ if(CURL_WERROR)
1832
+ if(MSVC)
1833
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
1834
+ else()
1835
+ # This assumes clang or gcc style options
1836
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
1837
+ endif()
1838
+ endif()
1839
+
1840
+ if(CURL_LTO)
1841
+ if(CMAKE_VERSION VERSION_LESS 3.9)
1842
+ message(FATAL_ERROR "LTO has been requested, but your cmake version ${CMAKE_VERSION} is to old. You need at least 3.9")
1843
+ endif()
1844
+
1845
+ cmake_policy(SET CMP0069 NEW)
1846
+
1847
+ include(CheckIPOSupported)
1848
+ check_ipo_supported(RESULT CURL_HAS_LTO OUTPUT _lto_error LANGUAGES C)
1849
+ if(CURL_HAS_LTO)
1850
+ message(STATUS "LTO supported and enabled")
1851
+ else()
1852
+ message(FATAL_ERROR "LTO has been requested, but the compiler does not support it\n${_lto_error}")
1853
+ endif()
1854
+ endif()
1855
+
1856
+
1857
+ # Ugly (but functional) way to include "Makefile.inc" by transforming it
1858
+ # (= regenerate it).
1859
+ function(transform_makefile_inc _input_file _output_file)
1860
+ file(READ ${_input_file} _makefile_inc_text)
1861
+ string(REPLACE "$(top_srcdir)" "\${PROJECT_SOURCE_DIR}" _makefile_inc_text ${_makefile_inc_text})
1862
+ string(REPLACE "$(top_builddir)" "\${PROJECT_BINARY_DIR}" _makefile_inc_text ${_makefile_inc_text})
1863
+
1864
+ string(REGEX REPLACE "\\\\\n" "!π!α!" _makefile_inc_text ${_makefile_inc_text})
1865
+ string(REGEX REPLACE "([a-zA-Z_][a-zA-Z0-9_]*)[\t ]*=[\t ]*([^\n]*)" "set(\\1 \\2)" _makefile_inc_text ${_makefile_inc_text})
1866
+ string(REPLACE "!π!α!" "\n" _makefile_inc_text ${_makefile_inc_text})
1867
+
1868
+ # Replace $() with ${}
1869
+ string(REGEX REPLACE "\\$\\(([a-zA-Z_][a-zA-Z0-9_]*)\\)" "\${\\1}" _makefile_inc_text ${_makefile_inc_text})
1870
+ # Replace @@ with ${}, even if that may not be read by CMake scripts.
1871
+ string(REGEX REPLACE "@([a-zA-Z_][a-zA-Z0-9_]*)@" "\${\\1}" _makefile_inc_text ${_makefile_inc_text})
1872
+
1873
+ file(WRITE ${_output_file} ${_makefile_inc_text})
1874
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${_input_file}")
1875
+ endfunction()
1876
+
1877
+ include(GNUInstallDirs)
1878
+
1879
+ set(_install_cmake_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
1880
+ set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
1881
+ set(_generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
1882
+ set(_project_config "${_generated_dir}/${PROJECT_NAME}Config.cmake")
1883
+ set(_version_config "${_generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
1884
+
1885
+ option(BUILD_TESTING "Build tests" ON)
1886
+ if(BUILD_TESTING AND PERL_FOUND AND NOT CURL_DISABLE_TESTS)
1887
+ set(CURL_BUILD_TESTING ON)
1888
+ else()
1889
+ set(CURL_BUILD_TESTING OFF)
1890
+ endif()
1891
+
1892
+ if(HAVE_MANUAL_TOOLS)
1893
+ set(CURL_MANPAGE "${PROJECT_BINARY_DIR}/docs/cmdline-opts/curl.1")
1894
+ set(CURL_ASCIIPAGE "${PROJECT_BINARY_DIR}/docs/cmdline-opts/curl.txt")
1895
+ add_subdirectory(docs)
1896
+ endif()
1897
+
1898
+ add_subdirectory(lib)
1899
+
1900
+ if(BUILD_CURL_EXE)
1901
+ add_subdirectory(src)
1902
+ endif()
1903
+
1904
+ option(BUILD_EXAMPLES "Build libcurl examples" ON)
1905
+ if(BUILD_EXAMPLES)
1906
+ add_subdirectory(docs/examples)
1907
+ endif()
1908
+
1909
+ if(CURL_BUILD_TESTING)
1910
+ add_subdirectory(tests)
1911
+ endif()
1912
+
1913
+ # Helper to populate a list (_items) with a label when conditions
1914
+ # (the remaining args) are satisfied
1915
+ macro(_add_if _label)
1916
+ # Needs to be a macro to allow this indirection
1917
+ if(${ARGN})
1918
+ set(_items ${_items} "${_label}")
1919
+ endif()
1920
+ endmacro()
1921
+
1922
+ # NTLM support requires crypto functions from various SSL libs.
1923
+ # These conditions must match those in lib/curl_setup.h.
1924
+ if(NOT CURL_DISABLE_NTLM AND
1925
+ (USE_OPENSSL OR
1926
+ USE_MBEDTLS OR
1927
+ USE_GNUTLS OR
1928
+ USE_SECTRANSP OR
1929
+ USE_WIN32_CRYPTO OR
1930
+ (USE_WOLFSSL AND HAVE_WOLFSSL_DES_ECB_ENCRYPT)))
1931
+ set(_use_curl_ntlm_core ON)
1932
+ endif()
1933
+
1934
+ # Clear list and try to detect available protocols
1935
+ unset(_items)
1936
+ _add_if("HTTP" NOT CURL_DISABLE_HTTP)
1937
+ _add_if("HTTPS" NOT CURL_DISABLE_HTTP AND _ssl_enabled)
1938
+ _add_if("FTP" NOT CURL_DISABLE_FTP)
1939
+ _add_if("FTPS" NOT CURL_DISABLE_FTP AND _ssl_enabled)
1940
+ _add_if("FILE" NOT CURL_DISABLE_FILE)
1941
+ _add_if("TELNET" NOT CURL_DISABLE_TELNET)
1942
+ _add_if("LDAP" NOT CURL_DISABLE_LDAP)
1943
+ # CURL_DISABLE_LDAP implies CURL_DISABLE_LDAPS
1944
+ _add_if("LDAPS" NOT CURL_DISABLE_LDAPS AND
1945
+ ((USE_OPENLDAP AND _ssl_enabled) OR
1946
+ (NOT USE_OPENLDAP AND HAVE_LDAP_SSL)))
1947
+ _add_if("DICT" NOT CURL_DISABLE_DICT)
1948
+ _add_if("TFTP" NOT CURL_DISABLE_TFTP)
1949
+ _add_if("GOPHER" NOT CURL_DISABLE_GOPHER)
1950
+ _add_if("GOPHERS" NOT CURL_DISABLE_GOPHER AND _ssl_enabled)
1951
+ _add_if("POP3" NOT CURL_DISABLE_POP3)
1952
+ _add_if("POP3S" NOT CURL_DISABLE_POP3 AND _ssl_enabled)
1953
+ _add_if("IMAP" NOT CURL_DISABLE_IMAP)
1954
+ _add_if("IMAPS" NOT CURL_DISABLE_IMAP AND _ssl_enabled)
1955
+ _add_if("SMB" NOT CURL_DISABLE_SMB AND
1956
+ _use_curl_ntlm_core AND (SIZEOF_CURL_OFF_T GREATER 4))
1957
+ _add_if("SMBS" NOT CURL_DISABLE_SMB AND _ssl_enabled AND
1958
+ _use_curl_ntlm_core AND (SIZEOF_CURL_OFF_T GREATER 4))
1959
+ _add_if("SMTP" NOT CURL_DISABLE_SMTP)
1960
+ _add_if("SMTPS" NOT CURL_DISABLE_SMTP AND _ssl_enabled)
1961
+ _add_if("SCP" USE_LIBSSH2 OR USE_LIBSSH OR USE_WOLFSSH)
1962
+ _add_if("SFTP" USE_LIBSSH2 OR USE_LIBSSH OR USE_WOLFSSH)
1963
+ _add_if("IPFS" NOT CURL_DISABLE_IPFS)
1964
+ _add_if("IPNS" NOT CURL_DISABLE_IPFS)
1965
+ _add_if("RTSP" NOT CURL_DISABLE_RTSP)
1966
+ _add_if("RTMP" USE_LIBRTMP)
1967
+ _add_if("MQTT" NOT CURL_DISABLE_MQTT)
1968
+ _add_if("WS" NOT CURL_DISABLE_WEBSOCKETS)
1969
+ _add_if("WSS" NOT CURL_DISABLE_WEBSOCKETS AND _ssl_enabled)
1970
+ if(_items)
1971
+ list(SORT _items)
1972
+ endif()
1973
+ string(REPLACE ";" " " SUPPORT_PROTOCOLS "${_items}")
1974
+ string(TOLOWER "${SUPPORT_PROTOCOLS}" _support_protocols_lower)
1975
+ message(STATUS "Protocols: ${_support_protocols_lower}")
1976
+
1977
+ # Clear list and try to detect available features
1978
+ unset(_items)
1979
+ _add_if("SSL" _ssl_enabled)
1980
+ _add_if("IPv6" ENABLE_IPV6)
1981
+ _add_if("UnixSockets" USE_UNIX_SOCKETS)
1982
+ _add_if("libz" HAVE_LIBZ)
1983
+ _add_if("brotli" HAVE_BROTLI)
1984
+ _add_if("gsasl" USE_GSASL)
1985
+ _add_if("zstd" HAVE_ZSTD)
1986
+ _add_if("AsynchDNS" USE_ARES OR USE_THREADS_POSIX OR USE_THREADS_WIN32)
1987
+ _add_if("IDN" (HAVE_LIBIDN2 AND HAVE_IDN2_H) OR
1988
+ USE_WIN32_IDN OR
1989
+ USE_APPLE_IDN)
1990
+ _add_if("Largefile" (SIZEOF_CURL_OFF_T GREATER 4) AND
1991
+ ((SIZEOF_OFF_T GREATER 4) OR USE_WIN32_LARGE_FILES))
1992
+ _add_if("SSPI" USE_WINDOWS_SSPI)
1993
+ _add_if("GSS-API" HAVE_GSSAPI)
1994
+ _add_if("alt-svc" NOT CURL_DISABLE_ALTSVC)
1995
+ _add_if("HSTS" NOT CURL_DISABLE_HSTS)
1996
+ _add_if("SPNEGO" NOT CURL_DISABLE_NEGOTIATE_AUTH AND
1997
+ (HAVE_GSSAPI OR USE_WINDOWS_SSPI))
1998
+ _add_if("Kerberos" NOT CURL_DISABLE_KERBEROS_AUTH AND
1999
+ (HAVE_GSSAPI OR USE_WINDOWS_SSPI))
2000
+ _add_if("NTLM" NOT (CURL_DISABLE_NTLM) AND
2001
+ (_use_curl_ntlm_core OR USE_WINDOWS_SSPI))
2002
+ _add_if("TLS-SRP" USE_TLS_SRP)
2003
+ _add_if("HTTP2" USE_NGHTTP2)
2004
+ _add_if("HTTP3" USE_NGTCP2 OR USE_QUICHE OR USE_MSH3 OR USE_OPENSSL_QUIC)
2005
+ _add_if("MultiSSL" CURL_WITH_MULTI_SSL)
2006
+ _add_if("HTTPS-proxy" _ssl_enabled AND (USE_OPENSSL OR USE_GNUTLS
2007
+ OR USE_SCHANNEL OR USE_RUSTLS OR USE_BEARSSL OR
2008
+ USE_MBEDTLS OR USE_SECTRANSP OR
2009
+ (USE_WOLFSSL AND HAVE_WOLFSSL_BIO)))
2010
+ _add_if("Unicode" ENABLE_UNICODE)
2011
+ _add_if("threadsafe" HAVE_ATOMIC OR
2012
+ (USE_THREADS_POSIX AND HAVE_PTHREAD_H) OR
2013
+ (WIN32 AND HAVE_WIN32_WINNT GREATER_EQUAL 0x0600))
2014
+ _add_if("Debug" ENABLE_DEBUG)
2015
+ _add_if("TrackMemory" ENABLE_CURLDEBUG)
2016
+ _add_if("ECH" _ssl_enabled AND HAVE_ECH)
2017
+ _add_if("PSL" USE_LIBPSL)
2018
+ _add_if("CAcert" CURL_CA_EMBED_SET)
2019
+ if(_items)
2020
+ if(NOT CMAKE_VERSION VERSION_LESS 3.13)
2021
+ list(SORT _items CASE INSENSITIVE)
2022
+ else()
2023
+ list(SORT _items)
2024
+ endif()
2025
+ endif()
2026
+ string(REPLACE ";" " " SUPPORT_FEATURES "${_items}")
2027
+ message(STATUS "Features: ${SUPPORT_FEATURES}")
2028
+
2029
+ # Clear list and collect SSL backends
2030
+ unset(_items)
2031
+ _add_if("Schannel" _ssl_enabled AND USE_SCHANNEL)
2032
+ _add_if("OpenSSL" _ssl_enabled AND USE_OPENSSL AND OPENSSL_VERSION VERSION_LESS 3.0.0)
2033
+ _add_if("OpenSSL v3+" _ssl_enabled AND USE_OPENSSL AND NOT OPENSSL_VERSION VERSION_LESS 3.0.0)
2034
+ _add_if("Secure Transport" _ssl_enabled AND USE_SECTRANSP)
2035
+ _add_if("mbedTLS" _ssl_enabled AND USE_MBEDTLS)
2036
+ _add_if("BearSSL" _ssl_enabled AND USE_BEARSSL)
2037
+ _add_if("wolfSSL" _ssl_enabled AND USE_WOLFSSL)
2038
+ _add_if("GnuTLS" _ssl_enabled AND USE_GNUTLS)
2039
+ _add_if("rustls" _ssl_enabled AND USE_RUSTLS)
2040
+
2041
+ if(_items)
2042
+ if(NOT CMAKE_VERSION VERSION_LESS 3.13)
2043
+ list(SORT _items CASE INSENSITIVE)
2044
+ else()
2045
+ list(SORT _items)
2046
+ endif()
2047
+ endif()
2048
+ string(REPLACE ";" " " SSL_BACKENDS "${_items}")
2049
+ message(STATUS "Enabled SSL backends: ${SSL_BACKENDS}")
2050
+ if(CURL_DEFAULT_SSL_BACKEND)
2051
+ message(STATUS "Default SSL backend: ${CURL_DEFAULT_SSL_BACKEND}")
2052
+ endif()
2053
+
2054
+ if(NOT CURL_DISABLE_INSTALL)
2055
+
2056
+ # curl-config needs the following options to be set.
2057
+ set(CC "${CMAKE_C_COMPILER}")
2058
+ # TODO: probably put a -D... options here?
2059
+ set(CONFIGURE_OPTIONS "")
2060
+ set(CURLVERSION "${_curl_version}")
2061
+ set(VERSIONNUM "${_curl_version_num}")
2062
+ set(prefix "${CMAKE_INSTALL_PREFIX}")
2063
+ set(exec_prefix "\${prefix}")
2064
+ if(IS_ABSOLUTE ${CMAKE_INSTALL_INCLUDEDIR})
2065
+ set(includedir "${CMAKE_INSTALL_INCLUDEDIR}")
2066
+ else()
2067
+ set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
2068
+ endif()
2069
+ if(IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR})
2070
+ set(libdir "${CMAKE_INSTALL_LIBDIR}")
2071
+ else()
2072
+ set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
2073
+ endif()
2074
+ # "a" (Linux) or "lib" (Windows)
2075
+ string(REPLACE "." "" libext "${CMAKE_STATIC_LIBRARY_SUFFIX}")
2076
+
2077
+ set(_ldflags "")
2078
+ set(LIBCURL_PC_LIBS_PRIVATE "")
2079
+
2080
+ # Filter CMAKE_SHARED_LINKER_FLAGS for libs and libpaths
2081
+ string(STRIP "${CMAKE_SHARED_LINKER_FLAGS}" _custom_ldflags)
2082
+ string(REGEX REPLACE " +-([^ \\t;]*)" ";-\\1" _custom_ldflags "${_custom_ldflags}")
2083
+
2084
+ set(_custom_libs "")
2085
+ set(_custom_libdirs "")
2086
+ foreach(_flag IN LISTS _custom_ldflags)
2087
+ if(_flag MATCHES "^-l")
2088
+ string(REGEX REPLACE "^-l" "" _flag "${_flag}")
2089
+ list(APPEND _custom_libs "${_flag}")
2090
+ elseif(_flag MATCHES "^-framework|^-F")
2091
+ list(APPEND _custom_libs "${_flag}")
2092
+ elseif(_flag MATCHES "^-L")
2093
+ string(REGEX REPLACE "^-L" "" _flag "${_flag}")
2094
+ list(APPEND _custom_libdirs "${_flag}")
2095
+ elseif(_flag MATCHES "^--library-path=")
2096
+ string(REGEX REPLACE "^--library-path=" "" _flag "${_flag}")
2097
+ list(APPEND _custom_libdirs "${_flag}")
2098
+ endif()
2099
+ endforeach()
2100
+
2101
+ # Avoid getting unnecessary -L options for known system directories.
2102
+ unset(_sys_libdirs)
2103
+ foreach(_libdir IN LISTS CMAKE_SYSTEM_PREFIX_PATH)
2104
+ if(_libdir MATCHES "/$")
2105
+ set(_libdir "${_libdir}lib")
2106
+ else()
2107
+ set(_libdir "${_libdir}/lib")
2108
+ endif()
2109
+ if(IS_DIRECTORY "${_libdir}")
2110
+ list(APPEND _sys_libdirs "${_libdir}")
2111
+ endif()
2112
+ if(DEFINED CMAKE_LIBRARY_ARCHITECTURE)
2113
+ set(_libdir "${_libdir}/${CMAKE_LIBRARY_ARCHITECTURE}")
2114
+ if(IS_DIRECTORY "${_libdir}")
2115
+ list(APPEND _sys_libdirs "${_libdir}")
2116
+ endif()
2117
+ endif()
2118
+ endforeach()
2119
+
2120
+ foreach(_libdir IN LISTS _custom_libdirs CURL_LIBDIRS)
2121
+ list(FIND _sys_libdirs "${_libdir}" _libdir_index)
2122
+ if(_libdir_index LESS 0)
2123
+ list(APPEND _ldflags "-L${_libdir}")
2124
+ endif()
2125
+ endforeach()
2126
+
2127
+ unset(_implicit_libs)
2128
+ if(NOT MINGW AND NOT UNIX)
2129
+ set(_implicit_libs ${CMAKE_C_IMPLICIT_LINK_LIBRARIES})
2130
+ endif()
2131
+
2132
+ foreach(_lib IN LISTS _implicit_libs _custom_libs CURL_LIBS)
2133
+ if(TARGET "${_lib}")
2134
+ set(_libname "${_lib}")
2135
+ get_target_property(_imported "${_libname}" IMPORTED)
2136
+ if(NOT _imported)
2137
+ # Reading the LOCATION property on non-imported target will error out.
2138
+ # Assume the user will not need this information in the .pc file.
2139
+ continue()
2140
+ endif()
2141
+ get_target_property(_lib "${_libname}" LOCATION)
2142
+ if(NOT _lib)
2143
+ message(WARNING "Bad lib in library list: ${_libname}")
2144
+ continue()
2145
+ endif()
2146
+ endif()
2147
+ if(_lib MATCHES "^-") # '-framework <name>'
2148
+ list(APPEND _ldflags "${_lib}")
2149
+ elseif(_lib MATCHES ".*/.*")
2150
+ # This gets a bit more complex, because we want to specify the
2151
+ # directory separately, and only once per directory
2152
+ get_filename_component(_libdir ${_lib} DIRECTORY)
2153
+ get_filename_component(_libname ${_lib} NAME_WE)
2154
+ if(_libname MATCHES "^lib")
2155
+ list(FIND _sys_libdirs "${_libdir}" _libdir_index)
2156
+ if(_libdir_index LESS 0)
2157
+ list(APPEND _ldflags "-L${_libdir}")
2158
+ endif()
2159
+ string(REGEX REPLACE "^lib" "" _libname "${_libname}")
2160
+ list(APPEND LIBCURL_PC_LIBS_PRIVATE "-l${_libname}")
2161
+ else()
2162
+ list(APPEND LIBCURL_PC_LIBS_PRIVATE "${_lib}")
2163
+ endif()
2164
+ else()
2165
+ list(APPEND LIBCURL_PC_LIBS_PRIVATE "-l${_lib}")
2166
+ endif()
2167
+ endforeach()
2168
+
2169
+ if(LIBCURL_PC_REQUIRES_PRIVATE)
2170
+ string(REPLACE ";" "," LIBCURL_PC_REQUIRES_PRIVATE "${LIBCURL_PC_REQUIRES_PRIVATE}")
2171
+ endif()
2172
+ if(LIBCURL_PC_LIBS_PRIVATE)
2173
+ string(REPLACE ";" " " LIBCURL_PC_LIBS_PRIVATE "${LIBCURL_PC_LIBS_PRIVATE}")
2174
+ endif()
2175
+ if(_ldflags)
2176
+ list(REMOVE_DUPLICATES _ldflags)
2177
+ string(REPLACE ";" " " _ldflags "${_ldflags}")
2178
+ set(LIBCURL_PC_LDFLAGS_PRIVATE "${_ldflags}")
2179
+ string(STRIP "${LIBCURL_PC_LDFLAGS_PRIVATE}" LIBCURL_PC_LDFLAGS_PRIVATE)
2180
+ else()
2181
+ set(LIBCURL_PC_LDFLAGS_PRIVATE "")
2182
+ endif()
2183
+ set(LIBCURL_PC_CFLAGS_PRIVATE "-DCURL_STATICLIB")
2184
+
2185
+ # Merge pkg-config private fields into public ones when static-only
2186
+ if(BUILD_SHARED_LIBS)
2187
+ set(ENABLE_SHARED "yes")
2188
+ set(LIBCURL_PC_REQUIRES "")
2189
+ set(LIBCURL_PC_LIBS "")
2190
+ set(LIBCURL_PC_CFLAGS "")
2191
+ else()
2192
+ set(ENABLE_SHARED "no")
2193
+ set(LIBCURL_PC_REQUIRES "${LIBCURL_PC_REQUIRES_PRIVATE}")
2194
+ set(LIBCURL_PC_LIBS "${LIBCURL_PC_LIBS_PRIVATE}")
2195
+ set(LIBCURL_PC_CFLAGS "${LIBCURL_PC_CFLAGS_PRIVATE}")
2196
+ endif()
2197
+ if(BUILD_STATIC_LIBS)
2198
+ set(ENABLE_STATIC "yes")
2199
+ else()
2200
+ set(ENABLE_STATIC "no")
2201
+ endif()
2202
+
2203
+ # Generate a "curl-config" matching this config.
2204
+ # Consumed variables:
2205
+ # CC
2206
+ # CONFIGURE_OPTIONS
2207
+ # CURLVERSION
2208
+ # CURL_CA_BUNDLE
2209
+ # ENABLE_SHARED
2210
+ # ENABLE_STATIC
2211
+ # exec_prefix
2212
+ # includedir
2213
+ # LIBCURL_PC_CFLAGS
2214
+ # LIBCURL_PC_LDFLAGS_PRIVATE
2215
+ # LIBCURL_PC_LIBS_PRIVATE
2216
+ # libdir
2217
+ # libext
2218
+ # prefix
2219
+ # SSL_BACKENDS
2220
+ # SUPPORT_FEATURES
2221
+ # SUPPORT_PROTOCOLS
2222
+ # VERSIONNUM
2223
+ configure_file(
2224
+ "${PROJECT_SOURCE_DIR}/curl-config.in"
2225
+ "${PROJECT_BINARY_DIR}/curl-config" @ONLY)
2226
+ install(FILES "${PROJECT_BINARY_DIR}/curl-config"
2227
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
2228
+ PERMISSIONS
2229
+ OWNER_READ OWNER_WRITE OWNER_EXECUTE
2230
+ GROUP_READ GROUP_EXECUTE
2231
+ WORLD_READ WORLD_EXECUTE)
2232
+
2233
+ # Generate a pkg-config file matching this config.
2234
+ # Consumed variables:
2235
+ # CURLVERSION
2236
+ # exec_prefix
2237
+ # includedir
2238
+ # LIBCURL_PC_CFLAGS
2239
+ # LIBCURL_PC_CFLAGS_PRIVATE
2240
+ # LIBCURL_PC_LDFLAGS_PRIVATE
2241
+ # LIBCURL_PC_LIBS
2242
+ # LIBCURL_PC_LIBS_PRIVATE
2243
+ # LIBCURL_PC_REQUIRES
2244
+ # LIBCURL_PC_REQUIRES_PRIVATE
2245
+ # libdir
2246
+ # prefix
2247
+ # SUPPORT_FEATURES
2248
+ # SUPPORT_PROTOCOLS
2249
+ # Documentation:
2250
+ # https://people.freedesktop.org/~dbn/pkg-config-guide.html
2251
+ # https://manpages.debian.org/unstable/pkgconf/pkg-config.1.en.html
2252
+ # https://manpages.debian.org/unstable/pkg-config/pkg-config.1.en.html
2253
+ # https://www.msys2.org/docs/pkgconfig/
2254
+ configure_file(
2255
+ "${PROJECT_SOURCE_DIR}/libcurl.pc.in"
2256
+ "${PROJECT_BINARY_DIR}/libcurl.pc" @ONLY)
2257
+ install(FILES "${PROJECT_BINARY_DIR}/libcurl.pc"
2258
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
2259
+
2260
+ # Install headers
2261
+ install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/curl"
2262
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
2263
+ FILES_MATCHING PATTERN "*.h")
2264
+
2265
+ include(CMakePackageConfigHelpers)
2266
+ write_basic_package_version_file(
2267
+ "${_version_config}"
2268
+ VERSION ${_curl_version}
2269
+ COMPATIBILITY SameMajorVersion)
2270
+ file(READ "${_version_config}" _generated_version_config)
2271
+ file(WRITE "${_version_config}" "
2272
+ if(NOT PACKAGE_FIND_VERSION_RANGE AND PACKAGE_FIND_VERSION_MAJOR STREQUAL \"7\")
2273
+ # Version 8 satisfies version 7... requirements
2274
+ set(PACKAGE_FIND_VERSION_MAJOR 8)
2275
+ set(PACKAGE_FIND_VERSION_COUNT 1)
2276
+ endif()
2277
+ ${_generated_version_config}")
2278
+
2279
+ # Consumed custom variables:
2280
+ # LIB_SELECTED
2281
+ # TARGETS_EXPORT_NAME
2282
+ # USE_OPENSSL
2283
+ # HAVE_LIBZ
2284
+ configure_package_config_file("CMake/curl-config.cmake.in"
2285
+ "${_project_config}"
2286
+ INSTALL_DESTINATION ${_install_cmake_dir}
2287
+ PATH_VARS CMAKE_INSTALL_INCLUDEDIR)
2288
+
2289
+ if(CURL_ENABLE_EXPORT_TARGET)
2290
+ install(EXPORT "${TARGETS_EXPORT_NAME}"
2291
+ NAMESPACE "${PROJECT_NAME}::"
2292
+ DESTINATION ${_install_cmake_dir})
2293
+ endif()
2294
+
2295
+ install(FILES ${_version_config} ${_project_config}
2296
+ DESTINATION ${_install_cmake_dir})
2297
+
2298
+ # Workaround for MSVS10 to avoid the Dialog Hell
2299
+ # FIXME: This could be removed with future version of CMake.
2300
+ if(MSVC_VERSION EQUAL 1600)
2301
+ set(_curl_sln_filename "${CMAKE_CURRENT_BINARY_DIR}/CURL.sln")
2302
+ if(EXISTS "${_curl_sln_filename}")
2303
+ file(APPEND "${_curl_sln_filename}" "\n# This should be regenerated!\n")
2304
+ endif()
2305
+ endif()
2306
+
2307
+ if(NOT TARGET curl_uninstall)
2308
+ configure_file(
2309
+ "${CMAKE_CURRENT_SOURCE_DIR}/CMake/cmake_uninstall.cmake.in"
2310
+ "${CMAKE_CURRENT_BINARY_DIR}/CMake/cmake_uninstall.cmake"
2311
+ @ONLY)
2312
+
2313
+ add_custom_target(curl_uninstall
2314
+ COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/CMake/cmake_uninstall.cmake")
2315
+ endif()
2316
+
2317
+ install(FILES "${PROJECT_SOURCE_DIR}/scripts/mk-ca-bundle.pl"
2318
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
2319
+ PERMISSIONS
2320
+ OWNER_READ OWNER_WRITE OWNER_EXECUTE
2321
+ GROUP_READ GROUP_EXECUTE
2322
+ WORLD_READ WORLD_EXECUTE)
2323
+
2324
+ # The `-DEV` part is important
2325
+ string(REGEX REPLACE "([0-9]+\.[0-9]+)\.([0-9]+.*)" "\\2" CPACK_PACKAGE_VERSION_PATCH "${_curl_version}")
2326
+ set(CPACK_GENERATOR "TGZ")
2327
+ include(CPack)
2328
+ endif()
2329
+
2330
+ # Save build info for test runner to pick up and log
2331
+ if(CMAKE_OSX_SYSROOT)
2332
+ set(_cmake_sysroot ${CMAKE_OSX_SYSROOT})
2333
+ elseif(CMAKE_SYSROOT)
2334
+ set(_cmake_sysroot ${CMAKE_SYSROOT})
2335
+ endif()
2336
+ set(_buildinfo "\
2337
+ buildinfo.configure.tool: cmake
2338
+ buildinfo.configure.command: ${CMAKE_COMMAND}
2339
+ buildinfo.configure.version: ${CMAKE_VERSION}
2340
+ buildinfo.configure.args:${_cmake_args}
2341
+ buildinfo.configure.generator: ${CMAKE_GENERATOR}
2342
+ buildinfo.configure.make: ${CMAKE_MAKE_PROGRAM}
2343
+ buildinfo.host.cpu: ${CMAKE_HOST_SYSTEM_PROCESSOR}
2344
+ buildinfo.host.os: ${CMAKE_HOST_SYSTEM_NAME}
2345
+ buildinfo.target.cpu: ${CMAKE_SYSTEM_PROCESSOR}
2346
+ buildinfo.target.os: ${CMAKE_SYSTEM_NAME}
2347
+ buildinfo.target.flags:${_target_flags}
2348
+ buildinfo.compiler: ${CMAKE_C_COMPILER_ID}
2349
+ buildinfo.compiler.version: ${CMAKE_C_COMPILER_VERSION}
2350
+ buildinfo.sysroot: ${_cmake_sysroot}
2351
+ ")
2352
+ file(WRITE "${PROJECT_BINARY_DIR}/buildinfo.txt" "# This is a generated file. Do not edit.\n${_buildinfo}")
2353
+ if(NOT "$ENV{CURL_BUILDINFO}$ENV{CURL_CI}$ENV{CI}" STREQUAL "")
2354
+ message(STATUS "\n${_buildinfo}")
2355
+ endif()
local-test-curl-delta-01/afc-curl/COPYING ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ COPYRIGHT AND PERMISSION NOTICE
2
+
3
+ Copyright (c) 1996 - 2024, Daniel Stenberg, <daniel@haxx.se>, and many
4
+ contributors, see the THANKS file.
5
+
6
+ All rights reserved.
7
+
8
+ Permission to use, copy, modify, and distribute this software for any purpose
9
+ with or without fee is hereby granted, provided that the above copyright
10
+ notice and this permission notice appear in all copies.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
15
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
18
+ OR OTHER DEALINGS IN THE SOFTWARE.
19
+
20
+ Except as contained in this notice, the name of a copyright holder shall not
21
+ be used in advertising or otherwise to promote the sale, use or other dealings
22
+ in this Software without prior written authorization of the copyright holder.
local-test-curl-delta-01/afc-curl/Dockerfile ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
2
+ #
3
+ # SPDX-License-Identifier: curl
4
+
5
+ # Self-contained build environment to match the release environment.
6
+ #
7
+ # Build and set the timestamp for the date corresponding to the release
8
+ #
9
+ # docker build --build-arg SOURCE_DATE_EPOCH=1711526400 --build-arg UID=$(id -u) --build-arg GID=$(id -g) -t curl/curl .
10
+ #
11
+ # Then run commands from within the build environment, for example
12
+ #
13
+ # docker run --rm -it -u $(id -u):$(id -g) -v $(pwd):/usr/src -w /usr/src curl/curl autoreconf -fi
14
+ # docker run --rm -it -u $(id -u):$(id -g) -v $(pwd):/usr/src -w /usr/src curl/curl ./configure --without-ssl --without-libpsl
15
+ # docker run --rm -it -u $(id -u):$(id -g) -v $(pwd):/usr/src -w /usr/src curl/curl make
16
+ # docker run --rm -it -u $(id -u):$(id -g) -v $(pwd):/usr/src -w /usr/src curl/curl ./scripts/maketgz 8.7.1
17
+ #
18
+ # or get into a shell in the build environment, for example
19
+ #
20
+ # docker run --rm -it -u $(id -u):$(id -g) -v (pwd):/usr/src -w /usr/src curl/curl bash
21
+ # $ autoreconf -fi
22
+ # $ ./configure --without-ssl --without-libpsl
23
+ # $ make
24
+ # $ ./scripts/maketgz 8.7.1
25
+
26
+ # To update, get the latest digest e.g. from https://hub.docker.com/_/debian/tags
27
+ FROM debian:bookworm-slim@sha256:b73bf02f32434c9be21adf83b9aedf33e731784d8d2dacbbd3ce5f4993f2a2de
28
+
29
+ RUN apt-get update -qq && apt-get install -qq -y --no-install-recommends \
30
+ build-essential make autoconf automake libtool git perl zip zlib1g-dev gawk && \
31
+ rm -rf /var/lib/apt/lists/*
32
+
33
+ ARG UID=1000 GID=1000
34
+
35
+ RUN groupadd --gid $UID dev && \
36
+ useradd --uid $UID --gid dev --shell /bin/bash --create-home dev
37
+
38
+ USER dev:dev
39
+
40
+ ARG SOURCE_DATE_EPOCH
41
+ ENV SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH:-1}
local-test-curl-delta-01/afc-curl/GIT-INFO.md ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _ _ ____ _
2
+ ___| | | | _ \| |
3
+ / __| | | | |_) | |
4
+ | (__| |_| | _ <| |___
5
+ \___|\___/|_| \_\_____|
6
+
7
+ # GIT-INFO
8
+
9
+ This file is only present in git - never in release archives. It contains
10
+ information about other files and things that the git repository keeps in its
11
+ inner sanctum.
12
+
13
+ To build in environments that support configure, after having extracted
14
+ everything from git, do this:
15
+
16
+ autoreconf -fi
17
+ ./configure --with-openssl
18
+ make
19
+
20
+ Daniel uses a configure line similar to this for easier development:
21
+
22
+ ./configure --disable-shared --enable-debug --enable-maintainer-mode
23
+
24
+ In environments that don't support configure (i.e. Windows), do this:
25
+
26
+ buildconf.bat
27
+
28
+ ## REQUIREMENTS
29
+
30
+ See [docs/INTERNALS.md][0] for requirement details.
31
+
32
+ [0]: docs/INTERNALS.md
local-test-curl-delta-01/afc-curl/Makefile.am ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
25
+ AUTOMAKE_OPTIONS = foreign
26
+
27
+ ACLOCAL_AMFLAGS = -I m4
28
+
29
+ CMAKE_DIST = \
30
+ CMake/cmake_uninstall.cmake.in \
31
+ CMake/CMakeConfigurableFile.in \
32
+ CMake/curl-config.cmake.in \
33
+ CMake/CurlSymbolHiding.cmake \
34
+ CMake/CurlTests.c \
35
+ CMake/FindBearSSL.cmake \
36
+ CMake/FindBrotli.cmake \
37
+ CMake/FindCares.cmake \
38
+ CMake/FindGSS.cmake \
39
+ CMake/FindLibgsasl.cmake \
40
+ CMake/FindLibidn2.cmake \
41
+ CMake/FindLibpsl.cmake \
42
+ CMake/FindLibssh.cmake \
43
+ CMake/FindLibssh2.cmake \
44
+ CMake/FindLibuv.cmake \
45
+ CMake/FindMbedTLS.cmake \
46
+ CMake/FindMSH3.cmake \
47
+ CMake/FindMbedTLS.cmake \
48
+ CMake/FindNGHTTP2.cmake \
49
+ CMake/FindNGHTTP3.cmake \
50
+ CMake/FindNGTCP2.cmake \
51
+ CMake/FindNettle.cmake \
52
+ CMake/FindQuiche.cmake \
53
+ CMake/FindRustls.cmake \
54
+ CMake/FindWolfSSH.cmake \
55
+ CMake/FindWolfSSL.cmake \
56
+ CMake/FindZstd.cmake \
57
+ CMake/Macros.cmake \
58
+ CMake/OtherTests.cmake \
59
+ CMake/PickyWarnings.cmake \
60
+ CMake/Platforms/WindowsCache.cmake \
61
+ CMake/Utilities.cmake \
62
+ CMakeLists.txt
63
+
64
+ VC_DIST = projects/README.md \
65
+ projects/build-openssl.bat \
66
+ projects/build-wolfssl.bat \
67
+ projects/checksrc.bat \
68
+ projects/generate.bat \
69
+ projects/wolfssl_options.h \
70
+ projects/wolfssl_override.props
71
+
72
+ WINBUILD_DIST = winbuild/README.md \
73
+ winbuild/MakefileBuild.vc winbuild/Makefile.vc winbuild/makedebug.bat
74
+
75
+ PLAN9_DIST = plan9/include/mkfile \
76
+ plan9/include/mkfile \
77
+ plan9/mkfile.proto \
78
+ plan9/mkfile \
79
+ plan9/README \
80
+ plan9/lib/mkfile.inc \
81
+ plan9/lib/mkfile \
82
+ plan9/src/mkfile.inc \
83
+ plan9/src/mkfile
84
+
85
+ EXTRA_DIST = CHANGES.md COPYING Makefile.dist \
86
+ RELEASE-NOTES $(CMAKE_DIST) $(VC_DIST) $(WINBUILD_DIST) \
87
+ $(PLAN9_DIST) buildconf.bat Dockerfile
88
+
89
+ CLEANFILES = $(VC14_LIBVCXPROJ) $(VC14_SRCVCXPROJ) \
90
+ $(VC14_10_LIBVCXPROJ) $(VC14_10_SRCVCXPROJ) \
91
+ $(VC14_20_LIBVCXPROJ) $(VC14_20_SRCVCXPROJ) \
92
+ $(VC14_30_LIBVCXPROJ) $(VC14_30_SRCVCXPROJ)
93
+
94
+ DISTCLEANFILES = buildinfo.txt
95
+
96
+ bin_SCRIPTS = curl-config
97
+
98
+ SUBDIRS = lib docs src scripts
99
+ DIST_SUBDIRS = $(SUBDIRS) tests packages include docs
100
+
101
+ pkgconfigdir = $(libdir)/pkgconfig
102
+ pkgconfig_DATA = libcurl.pc
103
+
104
+ # List of files required to generate VC IDE .dsp, .vcproj and .vcxproj files
105
+ include lib/Makefile.inc
106
+ include src/Makefile.inc
107
+
108
+ dist-hook:
109
+ rm -rf $(top_builddir)/tests/log
110
+ find $(distdir) -name "*.dist" -a \! -name Makefile.dist -exec rm {} \;
111
+ (distit=`find $(srcdir) -name "*.dist" | grep -v Makefile`; \
112
+ for file in $$distit; do \
113
+ strip=`echo $$file | sed -e s/^$(srcdir)// -e s/\.dist//`; \
114
+ cp -p $$file $(distdir)$$strip; \
115
+ done)
116
+
117
+ check: test examples check-docs
118
+
119
+ if CROSSCOMPILING
120
+ test-full: test
121
+ test-nonflaky: test
122
+ test-torture: test
123
+ test-event: test
124
+ test-am: test
125
+ test-ci: test
126
+ pytest: test
127
+ pytest-ci: test
128
+
129
+ test:
130
+ @echo "NOTICE: we can't run the tests when cross-compiling!"
131
+
132
+ else
133
+
134
+ test:
135
+ @(cd tests; $(MAKE) all quiet-test)
136
+
137
+ test-full:
138
+ @(cd tests; $(MAKE) all full-test)
139
+
140
+ test-nonflaky:
141
+ @(cd tests; $(MAKE) all nonflaky-test)
142
+
143
+ test-torture:
144
+ @(cd tests; $(MAKE) all torture-test)
145
+
146
+ test-event:
147
+ @(cd tests; $(MAKE) all event-test)
148
+
149
+ test-am:
150
+ @(cd tests; $(MAKE) all am-test)
151
+
152
+ test-ci:
153
+ @(cd tests; $(MAKE) all ci-test)
154
+
155
+ pytest:
156
+ @(cd tests; $(MAKE) all default-pytest)
157
+
158
+ pytest-ci:
159
+ @(cd tests; $(MAKE) all ci-pytest)
160
+
161
+ endif
162
+
163
+ examples:
164
+ @(cd docs/examples; $(MAKE) check)
165
+
166
+ check-docs:
167
+ @(cd docs/libcurl; $(MAKE) check)
168
+
169
+ # Build source and binary rpms. For rpm-3.0 and above, the ~/.rpmmacros
170
+ # must contain the following line:
171
+ # %_topdir /home/loic/local/rpm
172
+ # and that /home/loic/local/rpm contains the directory SOURCES, BUILD etc.
173
+ #
174
+ # cd /home/loic/local/rpm ; mkdir -p SOURCES BUILD RPMS/i386 SPECS SRPMS
175
+ #
176
+ # If additional configure flags are needed to build the package, add the
177
+ # following in ~/.rpmmacros
178
+ # %configure CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix} ${AM_CONFIGFLAGS}
179
+ # and run make rpm in the following way:
180
+ # AM_CONFIGFLAGS='--with-uri=/home/users/loic/local/RedHat-6.2' make rpm
181
+ #
182
+
183
+ rpms:
184
+ $(MAKE) RPMDIST=curl rpm
185
+ $(MAKE) RPMDIST=curl-ssl rpm
186
+
187
+ rpm:
188
+ RPM_TOPDIR=`rpm --showrc | $(PERL) -n -e 'print if(s/.*_topdir\s+(.*)/$$1/)'` ; \
189
+ cp $(srcdir)/packages/Linux/RPM/$(RPMDIST).spec $$RPM_TOPDIR/SPECS ; \
190
+ cp $(PACKAGE)-$(VERSION).tar.gz $$RPM_TOPDIR/SOURCES ; \
191
+ rpm -ba --clean --rmsource $$RPM_TOPDIR/SPECS/$(RPMDIST).spec ; \
192
+ mv $$RPM_TOPDIR/RPMS/i386/$(RPMDIST)-*.rpm . ; \
193
+ mv $$RPM_TOPDIR/SRPMS/$(RPMDIST)-*.src.rpm .
194
+
195
+ #
196
+ # Build a Solaris pkgadd format file
197
+ # run 'make pkgadd' once you've done './configure' and 'make' to make a Solaris pkgadd format
198
+ # file (which ends up back in this directory).
199
+ # The pkgadd file is in 'pkgtrans' format, so to install on Solaris, do
200
+ # pkgadd -d ./HAXXcurl-*
201
+ #
202
+
203
+ # gak - libtool requires an absolute directory, hence the pwd below...
204
+ pkgadd:
205
+ umask 022 ; \
206
+ $(MAKE) install DESTDIR=`/bin/pwd`/packages/Solaris/root ; \
207
+ cat COPYING > $(srcdir)/packages/Solaris/copyright ; \
208
+ cd $(srcdir)/packages/Solaris && $(MAKE) package
209
+
210
+ #
211
+ # Build a Cygwin binary tarball installation file
212
+ # resulting .tar.bz2 file will end up at packages/Win32/cygwin
213
+ cygwinbin:
214
+ $(MAKE) -C packages/Win32/cygwin cygwinbin
215
+
216
+ # We extend the standard install with a custom hook:
217
+ if BUILD_DOCS
218
+ install-data-hook:
219
+ (cd include && $(MAKE) install)
220
+ (cd docs && $(MAKE) install)
221
+ (cd docs/libcurl && $(MAKE) install)
222
+ else
223
+ install-data-hook:
224
+ (cd include && $(MAKE) install)
225
+ (cd docs && $(MAKE) install)
226
+ endif
227
+
228
+ # We extend the standard uninstall with a custom hook:
229
+ uninstall-hook:
230
+ (cd include && $(MAKE) uninstall)
231
+ (cd docs && $(MAKE) uninstall)
232
+ (cd docs/libcurl && $(MAKE) uninstall)
233
+
234
+ ca-bundle: $(srcdir)/scripts/mk-ca-bundle.pl
235
+ @echo "generating a fresh ca-bundle.crt"
236
+ @perl $(srcdir)/scripts/mk-ca-bundle.pl -b -l -u lib/ca-bundle.crt
237
+
238
+ ca-firefox: $(srcdir)/scripts/firefox-db2pem.sh
239
+ @echo "generating a fresh ca-bundle.crt"
240
+ $(srcdir)/scripts/firefox-db2pem.sh lib/ca-bundle.crt
241
+
242
+ checksrc:
243
+ (cd lib && $(MAKE) checksrc)
244
+ (cd src && $(MAKE) checksrc)
245
+ (cd tests && $(MAKE) checksrc)
246
+ (cd include/curl && $(MAKE) checksrc)
247
+ (cd docs/examples && $(MAKE) checksrc)
248
+ (cd packages && $(MAKE) checksrc)
249
+
250
+ tidy:
251
+ (cd src && $(MAKE) tidy)
252
+ (cd lib && $(MAKE) tidy)
local-test-curl-delta-01/afc-curl/Makefile.dist ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
25
+ all:
26
+ ./configure
27
+ make
28
+
29
+ ssl:
30
+ ./configure --with-openssl
31
+ make
32
+
33
+ vc:
34
+ cd winbuild
35
+ nmake /f Makefile.vc MACHINE=x86
36
+
37
+ vc-x64:
38
+ cd winbuild
39
+ nmake /f Makefile.vc MACHINE=x64
40
+
41
+ djgpp%:
42
+ $(MAKE) -C lib -f Makefile.mk CFG=$@ CROSSPREFIX=i586-pc-msdosdjgpp-
43
+ $(MAKE) -C src -f Makefile.mk CFG=$@ CROSSPREFIX=i586-pc-msdosdjgpp-
44
+
45
+ cygwin:
46
+ ./configure
47
+ make
48
+
49
+ cygwin-ssl:
50
+ ./configure --with-openssl
51
+ make
52
+
53
+ amiga%:
54
+ $(MAKE) -C lib -f Makefile.mk CFG=$@ CROSSPREFIX=m68k-amigaos-
55
+ $(MAKE) -C src -f Makefile.mk CFG=$@ CROSSPREFIX=m68k-amigaos-
56
+
57
+ unix: all
58
+
59
+ unix-ssl: ssl
60
+
61
+ linux: all
62
+
63
+ linux-ssl: ssl
64
+
65
+ ca-bundle: scripts/mk-ca-bundle.pl
66
+ @echo "generate a fresh ca-bundle.crt"
67
+ @perl $< -b -l -u lib/ca-bundle.crt
68
+
69
+ ca-firefox: scripts/firefox-db2pem.sh
70
+ @echo "generate a fresh ca-bundle.crt"
71
+ ./scripts/firefox-db2pem.sh lib/ca-bundle.crt
local-test-curl-delta-01/afc-curl/README ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _ _ ____ _
2
+ ___| | | | _ \| |
3
+ / __| | | | |_) | |
4
+ | (__| |_| | _ <| |___
5
+ \___|\___/|_| \_\_____|
6
+
7
+ README
8
+
9
+ Curl is a command line tool for transferring data specified with URL
10
+ syntax. Find out how to use curl by reading the curl.1 man page or the
11
+ MANUAL document. Find out how to install Curl by reading the INSTALL
12
+ document.
13
+
14
+ libcurl is the library curl is using to do its job. It is readily
15
+ available to be used by your software. Read the libcurl.3 man page to
16
+ learn how.
17
+
18
+ You find answers to the most frequent questions we get in the FAQ document.
19
+
20
+ Study the COPYING file for distribution terms.
21
+
22
+ Those documents and more can be found in the docs/ directory.
23
+
24
+ CONTACT
25
+
26
+ If you have problems, questions, ideas or suggestions, please contact us
27
+ by posting to a suitable mailing list. See https://curl.se/mail/
28
+
29
+ All contributors to the project are listed in the THANKS document.
30
+
31
+ WEBSITE
32
+
33
+ Visit the curl website for the latest news and downloads:
34
+
35
+ https://curl.se/
36
+
37
+ GIT
38
+
39
+ To download the latest source code off the GIT server, do this:
40
+
41
+ git clone https://github.com/curl/curl.git
42
+
43
+ (you will get a directory named curl created, filled with the source code)
44
+
45
+ SECURITY PROBLEMS
46
+
47
+ Report suspected security problems via our HackerOne page and not in public.
48
+
49
+ https://hackerone.com/curl
50
+
51
+ NOTICE
52
+
53
+ Curl contains pieces of source code that is Copyright (c) 1998, 1999
54
+ Kungliga Tekniska Högskolan. This notice is included here to comply with the
55
+ distribution terms.
local-test-curl-delta-01/afc-curl/README.md ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3
+
4
+ SPDX-License-Identifier: curl
5
+ -->
6
+
7
+ # [![curl logo](https://curl.se/logo/curl-logo.svg)](https://curl.se/)
8
+
9
+ Curl is a command-line tool for transferring data specified with URL syntax.
10
+ Learn how to use curl by reading [the
11
+ manpage](https://curl.se/docs/manpage.html) or [everything
12
+ curl](https://everything.curl.dev/).
13
+
14
+ Find out how to install curl by reading [the INSTALL
15
+ document](https://curl.se/docs/install.html).
16
+
17
+ libcurl is the library curl is using to do its job. It is readily available to
18
+ be used by your software. Read [the libcurl
19
+ manpage](https://curl.se/libcurl/c/libcurl.html) to learn how.
20
+
21
+ ## Open Source
22
+
23
+ curl is Open Source and is distributed under an MIT-like
24
+ [license](https://curl.se/docs/copyright.html).
25
+
26
+ ## Contact
27
+
28
+ Contact us on a suitable [mailing list](https://curl.se/mail/) or
29
+ use GitHub [issues](https://github.com/curl/curl/issues)/
30
+ [pull requests](https://github.com/curl/curl/pulls)/
31
+ [discussions](https://github.com/curl/curl/discussions).
32
+
33
+ All contributors to the project are listed in [the THANKS
34
+ document](https://curl.se/docs/thanks.html).
35
+
36
+ ## Commercial support
37
+
38
+ For commercial support, maybe private and dedicated help with your problems or
39
+ applications using (lib)curl visit [the support page](https://curl.se/support.html).
40
+
41
+ ## Website
42
+
43
+ Visit the [curl website](https://curl.se/) for the latest news and downloads.
44
+
45
+ ## Source code
46
+
47
+ Download the latest source from the Git server:
48
+
49
+ git clone https://github.com/curl/curl.git
50
+
51
+ ## Security problems
52
+
53
+ Report suspected security problems via [our HackerOne
54
+ page](https://hackerone.com/curl) and not in public.
55
+
56
+ ## Notice
57
+
58
+ Curl contains pieces of source code that is Copyright (c) 1998, 1999 Kungliga
59
+ Tekniska Högskolan. This notice is included here to comply with the
60
+ distribution terms.
61
+
62
+ ## Backers
63
+
64
+ Thank you to all our backers 🙏 [Become a backer](https://opencollective.com/curl#section-contribute).
65
+
66
+ ## Sponsors
67
+
68
+ Support this project by becoming a [sponsor](https://curl.se/sponsors.html).
local-test-curl-delta-01/afc-curl/RELEASE-NOTES ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ curl and libcurl 8.11.1
2
+
3
+ Public curl releases: 263
4
+ Command line options: 266
5
+ curl_easy_setopt() options: 306
6
+ Public functions in libcurl: 94
7
+ Contributors: 3298
8
+
9
+ This release includes the following changes:
10
+
11
+
12
+ This release includes the following bugfixes:
13
+
14
+ o build: fix ECH to always enable HTTPS RR [35]
15
+ o build: fix MSVC UWP builds [32]
16
+ o build: omit certain deps from `libcurl.pc` unless found via `pkg-config` [27]
17
+ o build: use `_fseeki64()` on Windows, drop detections [41]
18
+ o cmake: do not echo most inherited `LDFLAGS` to config files [55]
19
+ o cmake: drop cmake args list from `buildinfo.txt` [8]
20
+ o cmake: include `wolfssl/options.h` first [53]
21
+ o cmake: remove legacy unused IMMEDIATE keyword [21]
22
+ o cmake: restore cmake args list in `buildinfo.txt` [26]
23
+ o cmake: set `CURL_STATICLIB` for static lib when `SHARE_LIB_OBJECT=OFF` [64]
24
+ o cmake: sync GSS config code with other deps [28]
25
+ o cmake: typo in comment
26
+ o cmake: work around `ios.toolchain.cmake` breaking feature-detections [37]
27
+ o cmakelint: fix to check root `CMakeLists.txt` [36]
28
+ o cmdline/ech.md: formatting cleanups [13]
29
+ o configure: add FIXMEs for disabled pkg-config references
30
+ o configure: do not echo most inherited `LDFLAGS` to config files [31]
31
+ o configure: replace `$#` shell syntax [25]
32
+ o cookie: treat cookie name case sensitively [4]
33
+ o curl-rustls.m4: keep existing `CPPFLAGS`/`LDFLAGS` when detected [40]
34
+ o curl.h: mark two error codes as obsolete [19]
35
+ o curl: --continue-at is mutually exclusive with --no-clobber [51]
36
+ o curl: --continue-at is mutually exclusive with --range [61]
37
+ o curl: --continue-at is mutually exclusive with --remove-on-error [50]
38
+ o curl: --test-duphandle in debug builds runs "duphandled" [6]
39
+ o curl: do more command line parsing in sub functions [71]
40
+ o curl: rename struct var to fix AIX build [24]
41
+ o curl: use realtime in trace timestamps [52]
42
+ o curl_multi_socket_all.md: soften the deprecation warning [56]
43
+ o CURLOPT_PREREQFUNCTION.md: add result code on failure [23]
44
+ o digest: produce a shorter cnonce in Digest headers [70]
45
+ o DISTROS: update Alt Linux links
46
+ o dmaketgz: use --no-cache when building docker image [66]
47
+ o docs: document default `User-Agent` [57]
48
+ o docs: suggest --ssl-reqd instead of --ftp-ssl [62]
49
+ o duphandle: also init netrc [3]
50
+ o ECH: enable support for the AWS-LC backend [5]
51
+ o hostip: don't use the resolver for FQDN localhost [45]
52
+ o http_negotiate: allow for a one byte larger channel binding buffer [63]
53
+ o http_proxy: move dynhds_add_custom here from http.c [18]
54
+ o KNOWN_BUGS: setting a disabled option should return CURLE_NOT_BUILT_IN [74]
55
+ o krb5: fix socket/sockindex confusion, MSVC compiler warnings [22]
56
+ o lib: fixes for wolfSSL OPENSSL_COEXIST [73]
57
+ o libssh: use libssh sftp_aio to upload file [47]
58
+ o libssh: when using IPv6 numerical address, add brackets [43]
59
+ o macos: disable gcc `availability` workaround as needed [7]
60
+ o mbedtls: call psa_crypt_init() in global init [2]
61
+ o mime: fix reader stall on small read lengths [65]
62
+ o mk-ca-bundle: remove CKA_NSS_SERVER_DISTRUST_AFTER conditions [39]
63
+ o multi: add clarifying comment for wakeup_write() [9]
64
+ o multi: fix callback for `CURLMOPT_TIMERFUNCTION` not being called again when... [48]
65
+ o netrc: address several netrc parser flaws [17]
66
+ o netrc: support large file, longer lines, longer tokens [14]
67
+ o nghttp2: use custom memory functions [1]
68
+ o OpenSSL: improvde error message on expired certificate [59]
69
+ o openssl: remove three "Useless Assignments" [72]
70
+ o openssl: stop using SSL_CTX_ function prefix for our functions [20]
71
+ o os400: Fix IBMi builds [33]
72
+ o os400: Fix IBMi EBCDIC conversion of arguments [34]
73
+ o pytest: add test for use of CURLMOPT_MAX_HOST_CONNECTIONS [60]
74
+ o rtsp: check EOS in the RTSP receive and return an error code [49]
75
+ o schannel: remove TLS 1.3 ciphersuite-list support [54]
76
+ o setopt: fix CURLOPT_HTTP_CONTENT_DECODING [15]
77
+ o setopt: fix missing options for builds without HTTP & MQTT [10]
78
+ o show-headers.md: clarify the headers are saved with the data [58]
79
+ o socket: handle binding to "host!<ip>" [16]
80
+ o socketpair: fix enabling `USE_EVENTFD` [30]
81
+ o strtok: use namespaced `strtok_r` macro instead of redefining it [29]
82
+ o tests: add the ending time stamp in testcurl.pl
83
+ o tests: re-enable 2086, and 472, 1299, 1613 for Windows [38]
84
+ o TODO: consider OCSP stapling by default [11]
85
+ o tool_formparse: remove use of sscanf() [68]
86
+ o tool_getparam: parse --localport without using sscanf [67]
87
+ o tool_getpass: fix UWP `-Wnull-dereference` [46]
88
+ o tool_getpass: replace `getch()` call with `_getch()` on Windows [42]
89
+ o tool_urlglob: parse character globbing range without sscanf [69]
90
+ o vtls: fix compile warning when ALPN is not available [12]
91
+
92
+ This release includes the following known bugs:
93
+
94
+ See docs/KNOWN_BUGS (https://curl.se/docs/knownbugs.html)
95
+
96
+ For all changes ever done in curl:
97
+
98
+ See https://curl.se/changes.html
99
+
100
+ Planned upcoming removals include:
101
+
102
+ o TLS libraries not supporting TLS 1.3
103
+
104
+ See https://curl.se/dev/deprecate.html for details
105
+
106
+ This release would not have looked like this without help, code, reports and
107
+ advice from friends like these:
108
+
109
+ Alexis Savin, Andrew Ayer, Andrew Kirillov, Andy Fiddaman, Ben Greear,
110
+ Bo Anderson, Brendon Smith, chemodax, Dan Fandrich, Daniel Engberg,
111
+ Daniel Pouzzner, Daniel Stenberg, Dan Rosser, delogicsreal on github,
112
+ dengjfzh on github, Ethan Everett, Florian Eckert, galen11 on github,
113
+ Harmen Stoppels, Harry Sintonen, henrikjehgmti on github, hiimmat on github,
114
+ Jacob Champion, Jeroen Ooms, Jesus Malo Poyatos, jethrogb on github,
115
+ Kai Pastor, Logan Buth, Maarten Billemont, marcos-ng on github, Moritz,
116
+ newfunction on hackerone, Nicolas F., Peter Kokot, Peter Marko, Ray Satiro,
117
+ renovate[bot], Samuel Henrique, Stefan Eissing, SuperStormer on github,
118
+ Tal Regev, Thomas, tinyboxvk, tkzv on github, tranzystorekk on github,
119
+ Viktor Szakats, Vladislavs Sokurenko, wxiaoguang on github, Wyatt O'Day,
120
+ xiaofeng, Yoshimasa Ohno
121
+ (51 contributors)
122
+
123
+ References to bug reports and discussions on issues:
124
+
125
+ [1] = https://curl.se/bug/?i=15527
126
+ [2] = https://curl.se/bug/?i=15500
127
+ [3] = https://curl.se/bug/?i=15496
128
+ [4] = https://curl.se/bug/?i=15492
129
+ [5] = https://curl.se/bug/?i=15499
130
+ [6] = https://curl.se/bug/?i=15504
131
+ [7] = https://curl.se/bug/?i=15508
132
+ [8] = https://curl.se/bug/?i=15501
133
+ [9] = https://curl.se/bug/?i=15600
134
+ [10] = https://curl.se/bug/?i=15634
135
+ [11] = https://curl.se/bug/?i=15483
136
+ [12] = https://curl.se/bug/?i=15515
137
+ [13] = https://curl.se/bug/?i=15506
138
+ [14] = https://curl.se/bug/?i=15513
139
+ [15] = https://curl.se/bug/?i=15511
140
+ [16] = https://curl.se/bug/?i=15553
141
+ [17] = https://curl.se/bug/?i=15586
142
+ [18] = https://curl.se/bug/?i=15672
143
+ [19] = https://curl.se/bug/?i=15538
144
+ [20] = https://curl.se/bug/?i=15673
145
+ [21] = https://curl.se/bug/?i=15661
146
+ [22] = https://curl.se/bug/?i=15585
147
+ [23] = https://curl.se/bug/?i=15542
148
+ [24] = https://curl.se/bug/?i=15580
149
+ [25] = https://curl.se/bug/?i=15584
150
+ [26] = https://curl.se/bug/?i=15563
151
+ [27] = https://curl.se/bug/?i=15469
152
+ [28] = https://curl.se/bug/?i=15545
153
+ [29] = https://curl.se/bug/?i=15549
154
+ [30] = https://curl.se/bug/?i=15561
155
+ [31] = https://curl.se/bug/?i=15533
156
+ [32] = https://curl.se/bug/?i=15657
157
+ [33] = https://curl.se/bug/?i=15566
158
+ [34] = https://curl.se/bug/?i=15570
159
+ [35] = https://curl.se/bug/?i=15648
160
+ [36] = https://curl.se/bug/?i=15565
161
+ [37] = https://curl.se/bug/?i=15557
162
+ [38] = https://curl.se/bug/?i=15644
163
+ [39] = https://curl.se/bug/?i=15547
164
+ [40] = https://curl.se/bug/?i=15546
165
+ [41] = https://curl.se/bug/?i=15525
166
+ [42] = https://curl.se/bug/?i=15642
167
+ [43] = https://curl.se/bug/?i=15522
168
+ [45] = https://curl.se/bug/?i=15676
169
+ [46] = https://curl.se/bug/?i=15638
170
+ [47] = https://curl.se/bug/?i=15625
171
+ [48] = https://curl.se/bug/?i=15627
172
+ [49] = https://curl.se/bug/?i=15624
173
+ [50] = https://curl.se/bug/?i=15645
174
+ [51] = https://curl.se/bug/?i=15645
175
+ [52] = https://curl.se/bug/?i=15614
176
+ [53] = https://curl.se/bug/?i=15620
177
+ [54] = https://hackerone.com/reports/2792484
178
+ [55] = https://curl.se/bug/?i=15617
179
+ [56] = https://curl.se/mail/lib-2024-11/0029.html
180
+ [57] = https://curl.se/bug/?i=15608
181
+ [58] = https://curl.se/bug/?i=15605
182
+ [59] = https://curl.se/bug/?i=15612
183
+ [60] = https://curl.se/bug/?i=15494
184
+ [61] = https://curl.se/bug/?i=15646
185
+ [62] = https://curl.se/bug/?i=15658
186
+ [63] = https://curl.se/bug/?i=15685
187
+ [64] = https://curl.se/bug/?i=15695
188
+ [65] = https://curl.se/bug/?i=15688
189
+ [66] = https://curl.se/bug/?i=15689
190
+ [67] = https://curl.se/bug/?i=15681
191
+ [68] = https://curl.se/bug/?i=15683
192
+ [69] = https://curl.se/bug/?i=15682
193
+ [70] = https://curl.se/bug/?i=15653
194
+ [71] = https://curl.se/bug/?i=15680
195
+ [72] = https://curl.se/bug/?i=15679
196
+ [73] = https://curl.se/bug/?i=15650
197
+ [74] = https://curl.se/bug/?i=15472
local-test-curl-delta-01/afc-curl/REUSE.toml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: curl
2
+ # SPDX-FileCopyrightText: Daniel Stenberg, <daniel@haxx.se>, et al.
3
+
4
+ # This file describes the licensing and copyright situation for files that
5
+ # cannot be annotated directly, for example because of being simply
6
+ # uncommentable. Unless this is the case, a file should be annotated directly.
7
+ #
8
+ # This follows the REUSE specification: https://reuse.software/spec-3.2/#reusetoml
9
+
10
+ version = 1
11
+ SPDX-PackageName = "curl"
12
+ SPDX-PackageDownloadLocation = "https://curl.se/"
13
+
14
+ [[annotations]]
15
+ path = [
16
+ ".mailmap",
17
+ "docs/FAQ",
18
+ "docs/INSTALL",
19
+ "docs/KNOWN_BUGS",
20
+ "docs/libcurl/symbols-in-versions",
21
+ "docs/MAIL-ETIQUETTE",
22
+ "docs/options-in-versions",
23
+ "docs/THANKS",
24
+ "docs/TODO",
25
+ "GIT-INFO.md",
26
+ "lib/libcurl.vers.in",
27
+ "lib/libcurl.def",
28
+ "packages/OS400/README.OS400",
29
+ "packages/vms/build_vms.com",
30
+ "packages/vms/curl_release_note_start.txt",
31
+ "packages/vms/curlmsg.sdl",
32
+ "packages/vms/macro32_exactcase.patch",
33
+ "packages/vms/readme",
34
+ "plan9/README",
35
+ "projects/Windows/**", "projects/wolfssl_override.props",
36
+ "README",
37
+ "RELEASE-NOTES",
38
+ "renovate.json",
39
+ "tests/certs/**",
40
+ "tests/data/test**",
41
+ "tests/stunnel.pem",
42
+ "tests/valgrind.supp",
43
+ # checksrc control files
44
+ "docs/examples/.checksrc",
45
+ "lib/.checksrc",
46
+ "lib/vauth/.checksrc",
47
+ "lib/vquic/.checksrc",
48
+ "lib/vssh/.checksrc",
49
+ "lib/vtls/.checksrc",
50
+ "src/.checksrc",
51
+ "tests/libtest/.checksrc",
52
+ "tests/server/.checksrc",
53
+ ]
54
+ SPDX-FileCopyrightText = "Daniel Stenberg, <daniel@haxx.se>, et al."
55
+ SPDX-License-Identifier = "curl"
56
+ # If there is licensing/copyright information in or next to these files, prefer that
57
+ precedence = "closest"
local-test-curl-delta-01/afc-curl/SECURITY.md ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3
+
4
+ SPDX-License-Identifier: curl
5
+ -->
6
+
7
+ # Security Policy
8
+
9
+ Read our [Vulnerability Disclosure Policy](docs/VULN-DISCLOSURE-POLICY.md).
10
+
11
+ ## Reporting a Vulnerability
12
+
13
+ If you have found or just suspect a security problem somewhere in curl or
14
+ libcurl, report it on [HackerOne](https://hackerone.com/curl).
15
+
16
+ We treat security issues with confidentiality until controlled and disclosed responsibly.
17
+
18
+ ## OpenSSF Best Practices
19
+
20
+ curl has achieved Gold status on the Open Source Security Foundation (OpenSSF)
21
+ [Best Practices](https://bestpractices.dev/) (formerly Core Infrastructure
22
+ Initiative Best Practices), reflecting its adherence to rigorous
23
+ security and best practice standards. This achievement highlights curl's
24
+ comprehensive documentation, secure development processes, effective change
25
+ control mechanisms, and strong maintenance routines. Meeting these criteria
26
+ demonstrates curl's commitment to security and reliability, ensuring the
27
+ project's sustainability and trustworthiness. This underscores curl's role as
28
+ a leader in open-source software practices. More information can be found on
29
+ [curl's OpenSSF Best Practices project page](https://www.bestpractices.dev/projects/63).
local-test-curl-delta-01/afc-curl/acinclude.m4 ADDED
@@ -0,0 +1,1697 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
25
+ dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT])
26
+ dnl -------------------------------------------------
27
+ dnl Use the C preprocessor to find out if the given object-style symbol
28
+ dnl is defined and get its expansion. This macro will not use default
29
+ dnl includes even if no INCLUDES argument is given. This macro will run
30
+ dnl silently when invoked with three arguments. If the expansion would
31
+ dnl result in a set of double-quoted strings the returned expansion will
32
+ dnl actually be a single double-quoted string concatenating all them.
33
+
34
+ AC_DEFUN([CURL_CHECK_DEF], [
35
+ AC_REQUIRE([CURL_CPP_P])dnl
36
+ OLDCPPFLAGS=$CPPFLAGS
37
+ # CPPPFLAG comes from CURL_CPP_P
38
+ CPPFLAGS="$CPPFLAGS $CPPPFLAG"
39
+ AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
40
+ AS_VAR_PUSHDEF([ac_Def], [curl_cv_def_$1])dnl
41
+ if test -z "$SED"; then
42
+ AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
43
+ fi
44
+ if test -z "$GREP"; then
45
+ AC_MSG_ERROR([GREP not set. Cannot continue without GREP being set.])
46
+ fi
47
+ ifelse($3,,[AC_MSG_CHECKING([for preprocessor definition of $1])])
48
+ tmp_exp=""
49
+ AC_PREPROC_IFELSE([
50
+ AC_LANG_SOURCE(
51
+ ifelse($2,,,[$2])[[
52
+ #ifdef $1
53
+ CURL_DEF_TOKEN $1
54
+ #endif
55
+ ]])
56
+ ],[
57
+ tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \
58
+ "$GREP" CURL_DEF_TOKEN 2>/dev/null | \
59
+ "$SED" 's/.*CURL_DEF_TOKEN[[ ]][[ ]]*//' 2>/dev/null | \
60
+ "$SED" 's/[["]][[ ]]*[["]]//g' 2>/dev/null`
61
+ if test -z "$tmp_exp" || test "$tmp_exp" = "$1"; then
62
+ tmp_exp=""
63
+ fi
64
+ ])
65
+ if test -z "$tmp_exp"; then
66
+ AS_VAR_SET(ac_HaveDef, no)
67
+ ifelse($3,,[AC_MSG_RESULT([no])])
68
+ else
69
+ AS_VAR_SET(ac_HaveDef, yes)
70
+ AS_VAR_SET(ac_Def, $tmp_exp)
71
+ ifelse($3,,[AC_MSG_RESULT([$tmp_exp])])
72
+ fi
73
+ AS_VAR_POPDEF([ac_Def])dnl
74
+ AS_VAR_POPDEF([ac_HaveDef])dnl
75
+ CPPFLAGS=$OLDCPPFLAGS
76
+ ])
77
+
78
+
79
+ dnl CURL_CHECK_DEF_CC (SYMBOL, [INCLUDES], [SILENT])
80
+ dnl -------------------------------------------------
81
+ dnl Use the C compiler to find out only if the given symbol is defined
82
+ dnl or not, this can not find out its expansion. This macro will not use
83
+ dnl default includes even if no INCLUDES argument is given. This macro
84
+ dnl will run silently when invoked with three arguments.
85
+
86
+ AC_DEFUN([CURL_CHECK_DEF_CC], [
87
+ AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
88
+ ifelse($3,,[AC_MSG_CHECKING([for compiler definition of $1])])
89
+ AC_COMPILE_IFELSE([
90
+ AC_LANG_SOURCE(
91
+ ifelse($2,,,[$2])[[
92
+ int main(void)
93
+ {
94
+ #ifdef $1
95
+ return 0;
96
+ #else
97
+ #error force compilation error
98
+ #endif
99
+ }
100
+ ]])
101
+ ],[
102
+ tst_symbol_defined="yes"
103
+ ],[
104
+ tst_symbol_defined="no"
105
+ ])
106
+ if test "$tst_symbol_defined" = "yes"; then
107
+ AS_VAR_SET(ac_HaveDef, yes)
108
+ ifelse($3,,[AC_MSG_RESULT([yes])])
109
+ else
110
+ AS_VAR_SET(ac_HaveDef, no)
111
+ ifelse($3,,[AC_MSG_RESULT([no])])
112
+ fi
113
+ AS_VAR_POPDEF([ac_HaveDef])dnl
114
+ ])
115
+
116
+
117
+ dnl CURL_CHECK_LIB_XNET
118
+ dnl -------------------------------------------------
119
+ dnl Verify if X/Open network library is required.
120
+
121
+ AC_DEFUN([CURL_CHECK_LIB_XNET], [
122
+ AC_MSG_CHECKING([if X/Open network library is required])
123
+ tst_lib_xnet_required="no"
124
+ AC_COMPILE_IFELSE([
125
+ AC_LANG_SOURCE([[
126
+ int main(void)
127
+ {
128
+ #if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600)
129
+ return 0;
130
+ #elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
131
+ return 0;
132
+ #else
133
+ #error force compilation error
134
+ #endif
135
+ }
136
+ ]])
137
+ ],[
138
+ tst_lib_xnet_required="yes"
139
+ LIBS="-lxnet $LIBS"
140
+ ])
141
+ AC_MSG_RESULT([$tst_lib_xnet_required])
142
+ ])
143
+
144
+
145
+ dnl CURL_CHECK_AIX_ALL_SOURCE
146
+ dnl -------------------------------------------------
147
+ dnl Provides a replacement of traditional AC_AIX with
148
+ dnl an uniform behavior across all autoconf versions,
149
+ dnl and with our own placement rules.
150
+
151
+ AC_DEFUN([CURL_CHECK_AIX_ALL_SOURCE], [
152
+ AH_VERBATIM([_ALL_SOURCE],
153
+ [/* Define to 1 if OS is AIX. */
154
+ #ifndef _ALL_SOURCE
155
+ # undef _ALL_SOURCE
156
+ #endif])
157
+ AC_BEFORE([$0], [AC_SYS_LARGEFILE])dnl
158
+ AC_BEFORE([$0], [CURL_CONFIGURE_REENTRANT])dnl
159
+ AC_MSG_CHECKING([if OS is AIX (to define _ALL_SOURCE)])
160
+ AC_EGREP_CPP([yes_this_is_aix],[
161
+ #ifdef _AIX
162
+ yes_this_is_aix
163
+ #endif
164
+ ],[
165
+ AC_MSG_RESULT([yes])
166
+ AC_DEFINE(_ALL_SOURCE)
167
+ ],[
168
+ AC_MSG_RESULT([no])
169
+ ])
170
+ ])
171
+
172
+
173
+ dnl CURL_CHECK_NATIVE_WINDOWS
174
+ dnl -------------------------------------------------
175
+ dnl Check if building a native Windows target
176
+
177
+ AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
178
+ AC_CACHE_CHECK([whether build target is a native Windows one], [curl_cv_native_windows], [
179
+ AC_COMPILE_IFELSE([
180
+ AC_LANG_PROGRAM([[
181
+ ]],[[
182
+ #ifdef _WIN32
183
+ int dummy=1;
184
+ #else
185
+ #error Not a native Windows build target.
186
+ #endif
187
+ ]])
188
+ ],[
189
+ curl_cv_native_windows="yes"
190
+ ],[
191
+ curl_cv_native_windows="no"
192
+ ])
193
+ ])
194
+ AM_CONDITIONAL(DOING_NATIVE_WINDOWS, test "x$curl_cv_native_windows" = xyes)
195
+ ])
196
+
197
+
198
+ dnl CURL_CHECK_HEADER_LBER
199
+ dnl -------------------------------------------------
200
+ dnl Check for compilable and valid lber.h header,
201
+ dnl and check if it is needed even with ldap.h
202
+
203
+ AC_DEFUN([CURL_CHECK_HEADER_LBER], [
204
+ AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
205
+ AC_CACHE_CHECK([for lber.h], [curl_cv_header_lber_h], [
206
+ AC_COMPILE_IFELSE([
207
+ AC_LANG_PROGRAM([[
208
+ #undef inline
209
+ #ifdef _WIN32
210
+ #ifndef WIN32_LEAN_AND_MEAN
211
+ #define WIN32_LEAN_AND_MEAN
212
+ #endif
213
+ #include <windows.h>
214
+ #else
215
+ #ifdef HAVE_SYS_TYPES_H
216
+ #include <sys/types.h>
217
+ #endif
218
+ #endif
219
+ #ifndef NULL
220
+ #define NULL (void *)0
221
+ #endif
222
+ #include <lber.h>
223
+ ]],[[
224
+ BerValue *bvp = NULL;
225
+ BerElement *bep = ber_init(bvp);
226
+ ber_free(bep, 1);
227
+ ]])
228
+ ],[
229
+ curl_cv_header_lber_h="yes"
230
+ ],[
231
+ curl_cv_header_lber_h="no"
232
+ ])
233
+ ])
234
+ if test "$curl_cv_header_lber_h" = "yes"; then
235
+ AC_DEFINE_UNQUOTED(HAVE_LBER_H, 1,
236
+ [Define to 1 if you have the lber.h header file.])
237
+ #
238
+ AC_COMPILE_IFELSE([
239
+ AC_LANG_PROGRAM([[
240
+ #undef inline
241
+ #ifdef _WIN32
242
+ #ifndef WIN32_LEAN_AND_MEAN
243
+ #define WIN32_LEAN_AND_MEAN
244
+ #endif
245
+ #include <windows.h>
246
+ #else
247
+ #ifdef HAVE_SYS_TYPES_H
248
+ #include <sys/types.h>
249
+ #endif
250
+ #endif
251
+ #ifndef NULL
252
+ #define NULL (void *)0
253
+ #endif
254
+ #ifndef LDAP_DEPRECATED
255
+ #define LDAP_DEPRECATED 1
256
+ #endif
257
+ #include <ldap.h>
258
+ ]],[[
259
+ BerValue *bvp = NULL;
260
+ BerElement *bep = ber_init(bvp);
261
+ ber_free(bep, 1);
262
+ ]])
263
+ ],[
264
+ curl_cv_need_header_lber_h="no"
265
+ ],[
266
+ curl_cv_need_header_lber_h="yes"
267
+ ])
268
+ #
269
+ case "$curl_cv_need_header_lber_h" in
270
+ yes)
271
+ AC_DEFINE_UNQUOTED(NEED_LBER_H, 1,
272
+ [Define to 1 if you need the lber.h header file even with ldap.h])
273
+ ;;
274
+ esac
275
+ fi
276
+ ])
277
+
278
+
279
+ dnl CURL_CHECK_HEADER_LDAP
280
+ dnl -------------------------------------------------
281
+ dnl Check for compilable and valid ldap.h header
282
+
283
+ AC_DEFUN([CURL_CHECK_HEADER_LDAP], [
284
+ AC_REQUIRE([CURL_CHECK_HEADER_LBER])dnl
285
+ AC_CACHE_CHECK([for ldap.h], [curl_cv_header_ldap_h], [
286
+ AC_COMPILE_IFELSE([
287
+ AC_LANG_PROGRAM([[
288
+ #undef inline
289
+ #ifdef _WIN32
290
+ #ifndef WIN32_LEAN_AND_MEAN
291
+ #define WIN32_LEAN_AND_MEAN
292
+ #endif
293
+ #include <windows.h>
294
+ #else
295
+ #ifdef HAVE_SYS_TYPES_H
296
+ #include <sys/types.h>
297
+ #endif
298
+ #endif
299
+ #ifndef LDAP_DEPRECATED
300
+ #define LDAP_DEPRECATED 1
301
+ #endif
302
+ #ifdef NEED_LBER_H
303
+ #include <lber.h>
304
+ #endif
305
+ #include <ldap.h>
306
+ ]],[[
307
+ LDAP *ldp = ldap_init("0.0.0.0", LDAP_PORT);
308
+ int res = ldap_unbind(ldp);
309
+ ]])
310
+ ],[
311
+ curl_cv_header_ldap_h="yes"
312
+ ],[
313
+ curl_cv_header_ldap_h="no"
314
+ ])
315
+ ])
316
+ case "$curl_cv_header_ldap_h" in
317
+ yes)
318
+ AC_DEFINE_UNQUOTED(HAVE_LDAP_H, 1,
319
+ [Define to 1 if you have the ldap.h header file.])
320
+ ;;
321
+ esac
322
+ ])
323
+
324
+
325
+ dnl CURL_CHECK_HEADER_LDAP_SSL
326
+ dnl -------------------------------------------------
327
+ dnl Check for compilable and valid ldap_ssl.h header
328
+
329
+ AC_DEFUN([CURL_CHECK_HEADER_LDAP_SSL], [
330
+ AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
331
+ AC_CACHE_CHECK([for ldap_ssl.h], [curl_cv_header_ldap_ssl_h], [
332
+ AC_COMPILE_IFELSE([
333
+ AC_LANG_PROGRAM([[
334
+ #undef inline
335
+ #ifdef _WIN32
336
+ #ifndef WIN32_LEAN_AND_MEAN
337
+ #define WIN32_LEAN_AND_MEAN
338
+ #endif
339
+ #include <windows.h>
340
+ #else
341
+ #ifdef HAVE_SYS_TYPES_H
342
+ #include <sys/types.h>
343
+ #endif
344
+ #endif
345
+ #ifndef LDAP_DEPRECATED
346
+ #define LDAP_DEPRECATED 1
347
+ #endif
348
+ #ifdef NEED_LBER_H
349
+ #include <lber.h>
350
+ #endif
351
+ #ifdef HAVE_LDAP_H
352
+ #include <ldap.h>
353
+ #endif
354
+ #include <ldap_ssl.h>
355
+ ]],[[
356
+ LDAP *ldp = ldapssl_init("0.0.0.0", LDAPS_PORT, 1);
357
+ ]])
358
+ ],[
359
+ curl_cv_header_ldap_ssl_h="yes"
360
+ ],[
361
+ curl_cv_header_ldap_ssl_h="no"
362
+ ])
363
+ ])
364
+ case "$curl_cv_header_ldap_ssl_h" in
365
+ yes)
366
+ AC_DEFINE_UNQUOTED(HAVE_LDAP_SSL_H, 1,
367
+ [Define to 1 if you have the ldap_ssl.h header file.])
368
+ ;;
369
+ esac
370
+ ])
371
+
372
+
373
+ dnl CURL_CHECK_LIBS_WINLDAP
374
+ dnl -------------------------------------------------
375
+ dnl Check for libraries needed for WINLDAP support,
376
+ dnl and prepended to LIBS any needed libraries.
377
+ dnl This macro can take an optional parameter with a
378
+ dnl whitespace separated list of libraries to check
379
+ dnl before the WINLDAP default ones.
380
+
381
+ AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [
382
+ AC_REQUIRE([CURL_CHECK_HEADER_WINBER])dnl
383
+ #
384
+ AC_MSG_CHECKING([for WINLDAP libraries])
385
+ #
386
+ u_libs=""
387
+ #
388
+ ifelse($1,,,[
389
+ for x_lib in $1; do
390
+ case "$x_lib" in
391
+ -l*)
392
+ l_lib="$x_lib"
393
+ ;;
394
+ *)
395
+ l_lib="-l$x_lib"
396
+ ;;
397
+ esac
398
+ if test -z "$u_libs"; then
399
+ u_libs="$l_lib"
400
+ else
401
+ u_libs="$u_libs $l_lib"
402
+ fi
403
+ done
404
+ ])
405
+ #
406
+ curl_cv_save_LIBS="$LIBS"
407
+ curl_cv_ldap_LIBS="unknown"
408
+ #
409
+ for x_nlibs in '' "$u_libs" \
410
+ '-lwldap32' ; do
411
+ if test "$curl_cv_ldap_LIBS" = "unknown"; then
412
+ if test -z "$x_nlibs"; then
413
+ LIBS="$curl_cv_save_LIBS"
414
+ else
415
+ LIBS="$x_nlibs $curl_cv_save_LIBS"
416
+ fi
417
+ AC_LINK_IFELSE([
418
+ AC_LANG_PROGRAM([[
419
+ #undef inline
420
+ #ifdef _WIN32
421
+ #ifndef WIN32_LEAN_AND_MEAN
422
+ #define WIN32_LEAN_AND_MEAN
423
+ #endif
424
+ #include <windows.h>
425
+ #include <winldap.h>
426
+ #ifdef HAVE_WINBER_H
427
+ #include <winber.h>
428
+ #endif
429
+ #endif
430
+ ]],[[
431
+ BERVAL *bvp = NULL;
432
+ BerElement *bep = ber_init(bvp);
433
+ LDAP *ldp = ldap_init("0.0.0.0", LDAP_PORT);
434
+ ULONG res = ldap_unbind(ldp);
435
+ ber_free(bep, 1);
436
+ ]])
437
+ ],[
438
+ curl_cv_ldap_LIBS="$x_nlibs"
439
+ ])
440
+ fi
441
+ done
442
+ #
443
+ LIBS="$curl_cv_save_LIBS"
444
+ #
445
+ case X-"$curl_cv_ldap_LIBS" in
446
+ X-unknown)
447
+ AC_MSG_RESULT([cannot find WINLDAP libraries])
448
+ ;;
449
+ X-)
450
+ AC_MSG_RESULT([no additional lib required])
451
+ ;;
452
+ *)
453
+ if test -z "$curl_cv_save_LIBS"; then
454
+ LIBS="$curl_cv_ldap_LIBS"
455
+ else
456
+ LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
457
+ fi
458
+ AC_MSG_RESULT([$curl_cv_ldap_LIBS])
459
+ ;;
460
+ esac
461
+ #
462
+ ])
463
+
464
+
465
+ dnl CURL_CHECK_LIBS_LDAP
466
+ dnl -------------------------------------------------
467
+ dnl Check for libraries needed for LDAP support,
468
+ dnl and prepended to LIBS any needed libraries.
469
+ dnl This macro can take an optional parameter with a
470
+ dnl whitespace separated list of libraries to check
471
+ dnl before the default ones.
472
+
473
+ AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
474
+ AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
475
+ #
476
+ AC_MSG_CHECKING([for LDAP libraries])
477
+ #
478
+ u_libs=""
479
+ #
480
+ ifelse($1,,,[
481
+ for x_lib in $1; do
482
+ case "$x_lib" in
483
+ -l*)
484
+ l_lib="$x_lib"
485
+ ;;
486
+ *)
487
+ l_lib="-l$x_lib"
488
+ ;;
489
+ esac
490
+ if test -z "$u_libs"; then
491
+ u_libs="$l_lib"
492
+ else
493
+ u_libs="$u_libs $l_lib"
494
+ fi
495
+ done
496
+ ])
497
+ #
498
+ curl_cv_save_LIBS="$LIBS"
499
+ curl_cv_ldap_LIBS="unknown"
500
+ #
501
+ for x_nlibs in '' "$u_libs" \
502
+ '-lldap' \
503
+ '-lldap -llber' \
504
+ '-llber -lldap' \
505
+ '-lldapssl -lldapx -lldapsdk' \
506
+ '-lldapsdk -lldapx -lldapssl' \
507
+ '-lldap -llber -lssl -lcrypto'; do
508
+
509
+ if test "$curl_cv_ldap_LIBS" = "unknown"; then
510
+ if test -z "$x_nlibs"; then
511
+ LIBS="$curl_cv_save_LIBS"
512
+ else
513
+ LIBS="$x_nlibs $curl_cv_save_LIBS"
514
+ fi
515
+ AC_LINK_IFELSE([
516
+ AC_LANG_PROGRAM([[
517
+ #undef inline
518
+ #ifdef _WIN32
519
+ #ifndef WIN32_LEAN_AND_MEAN
520
+ #define WIN32_LEAN_AND_MEAN
521
+ #endif
522
+ #include <windows.h>
523
+ #else
524
+ #ifdef HAVE_SYS_TYPES_H
525
+ #include <sys/types.h>
526
+ #endif
527
+ #endif
528
+ #ifndef NULL
529
+ #define NULL (void *)0
530
+ #endif
531
+ #ifndef LDAP_DEPRECATED
532
+ #define LDAP_DEPRECATED 1
533
+ #endif
534
+ #ifdef NEED_LBER_H
535
+ #include <lber.h>
536
+ #endif
537
+ #ifdef HAVE_LDAP_H
538
+ #include <ldap.h>
539
+ #endif
540
+ ]],[[
541
+ BerValue *bvp = NULL;
542
+ BerElement *bep = ber_init(bvp);
543
+ LDAP *ldp = ldap_init("0.0.0.0", LDAP_PORT);
544
+ int res = ldap_unbind(ldp);
545
+ ber_free(bep, 1);
546
+ ]])
547
+ ],[
548
+ curl_cv_ldap_LIBS="$x_nlibs"
549
+ ])
550
+ fi
551
+ done
552
+ #
553
+ LIBS="$curl_cv_save_LIBS"
554
+ #
555
+ case X-"$curl_cv_ldap_LIBS" in
556
+ X-unknown)
557
+ AC_MSG_RESULT([cannot find LDAP libraries])
558
+ ;;
559
+ X-)
560
+ AC_MSG_RESULT([no additional lib required])
561
+ ;;
562
+ *)
563
+ if test -z "$curl_cv_save_LIBS"; then
564
+ LIBS="$curl_cv_ldap_LIBS"
565
+ else
566
+ LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
567
+ fi
568
+ # FIXME: Enable when ldap was detected via pkg-config
569
+ if false; then
570
+ LIBCURL_PC_REQUIRES_PRIVATE="ldap $LIBCURL_PC_REQUIRES_PRIVATE"
571
+ fi
572
+ AC_MSG_RESULT([$curl_cv_ldap_LIBS])
573
+ ;;
574
+ esac
575
+ #
576
+ ])
577
+
578
+
579
+ dnl TYPE_SOCKADDR_STORAGE
580
+ dnl -------------------------------------------------
581
+ dnl Check for struct sockaddr_storage. Most IPv6-enabled
582
+ dnl hosts have it, but AIX 4.3 is one known exception.
583
+
584
+ AC_DEFUN([TYPE_SOCKADDR_STORAGE],
585
+ [
586
+ AC_CHECK_TYPE([struct sockaddr_storage],
587
+ AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
588
+ [if struct sockaddr_storage is defined]), ,
589
+ [
590
+ #undef inline
591
+ #ifdef _WIN32
592
+ #ifndef WIN32_LEAN_AND_MEAN
593
+ #define WIN32_LEAN_AND_MEAN
594
+ #endif
595
+ #include <winsock2.h>
596
+ #else
597
+ #ifdef HAVE_SYS_TYPES_H
598
+ #include <sys/types.h>
599
+ #endif
600
+ #ifdef HAVE_SYS_SOCKET_H
601
+ #include <sys/socket.h>
602
+ #endif
603
+ #ifdef HAVE_NETINET_IN_H
604
+ #include <netinet/in.h>
605
+ #endif
606
+ #ifdef HAVE_ARPA_INET_H
607
+ #include <arpa/inet.h>
608
+ #endif
609
+ #endif
610
+ ])
611
+ ])
612
+
613
+ dnl CURL_CHECK_FUNC_RECV
614
+ dnl -------------------------------------------------
615
+ dnl Test if the socket recv() function is available,
616
+
617
+ AC_DEFUN([CURL_CHECK_FUNC_RECV], [
618
+ AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
619
+ AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
620
+ AC_CHECK_HEADERS(sys/types.h sys/socket.h)
621
+ #
622
+ AC_MSG_CHECKING([for recv])
623
+ AC_LINK_IFELSE([
624
+ AC_LANG_PROGRAM([[
625
+ #undef inline
626
+ #ifdef _WIN32
627
+ #ifndef WIN32_LEAN_AND_MEAN
628
+ #define WIN32_LEAN_AND_MEAN
629
+ #endif
630
+ #include <winsock2.h>
631
+ #else
632
+ $curl_includes_bsdsocket
633
+ #ifdef HAVE_SYS_TYPES_H
634
+ #include <sys/types.h>
635
+ #endif
636
+ #ifdef HAVE_SYS_SOCKET_H
637
+ #include <sys/socket.h>
638
+ #endif
639
+ #endif
640
+ ]],[[
641
+ recv(0, 0, 0, 0);
642
+ ]])
643
+ ],[
644
+ AC_MSG_RESULT([yes])
645
+ curl_cv_recv="yes"
646
+ ],[
647
+ AC_MSG_RESULT([no])
648
+ curl_cv_recv="no"
649
+ ])
650
+ #
651
+ if test "$curl_cv_recv" = "yes"; then
652
+ AC_DEFINE_UNQUOTED(HAVE_RECV, 1,
653
+ [Define to 1 if you have the recv function.])
654
+ curl_cv_func_recv="yes"
655
+ else
656
+ AC_MSG_ERROR([Unable to link function recv])
657
+ fi
658
+ ])
659
+
660
+
661
+ dnl CURL_CHECK_FUNC_SEND
662
+ dnl -------------------------------------------------
663
+ dnl Test if the socket send() function is available,
664
+
665
+ AC_DEFUN([CURL_CHECK_FUNC_SEND], [
666
+ AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
667
+ AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
668
+ AC_CHECK_HEADERS(sys/types.h sys/socket.h)
669
+ #
670
+ AC_MSG_CHECKING([for send])
671
+ AC_LINK_IFELSE([
672
+ AC_LANG_PROGRAM([[
673
+ #undef inline
674
+ #ifdef _WIN32
675
+ #ifndef WIN32_LEAN_AND_MEAN
676
+ #define WIN32_LEAN_AND_MEAN
677
+ #endif
678
+ #include <winsock2.h>
679
+ #else
680
+ $curl_includes_bsdsocket
681
+ #ifdef HAVE_SYS_TYPES_H
682
+ #include <sys/types.h>
683
+ #endif
684
+ #ifdef HAVE_SYS_SOCKET_H
685
+ #include <sys/socket.h>
686
+ #endif
687
+ #endif
688
+ ]],[[
689
+ send(0, 0, 0, 0);
690
+ ]])
691
+ ],[
692
+ AC_MSG_RESULT([yes])
693
+ curl_cv_send="yes"
694
+ ],[
695
+ AC_MSG_RESULT([no])
696
+ curl_cv_send="no"
697
+ ])
698
+ #
699
+ if test "$curl_cv_send" = "yes"; then
700
+ AC_DEFINE_UNQUOTED(HAVE_SEND, 1,
701
+ [Define to 1 if you have the send function.])
702
+ curl_cv_func_send="yes"
703
+ else
704
+ AC_MSG_ERROR([Unable to link function send])
705
+ fi
706
+ ])
707
+
708
+ dnl CURL_CHECK_MSG_NOSIGNAL
709
+ dnl -------------------------------------------------
710
+ dnl Check for MSG_NOSIGNAL
711
+
712
+ AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
713
+ AC_CHECK_HEADERS(sys/types.h sys/socket.h)
714
+ AC_CACHE_CHECK([for MSG_NOSIGNAL], [curl_cv_msg_nosignal], [
715
+ AC_COMPILE_IFELSE([
716
+ AC_LANG_PROGRAM([[
717
+ #undef inline
718
+ #ifdef _WIN32
719
+ #ifndef WIN32_LEAN_AND_MEAN
720
+ #define WIN32_LEAN_AND_MEAN
721
+ #endif
722
+ #include <winsock2.h>
723
+ #else
724
+ #ifdef HAVE_SYS_TYPES_H
725
+ #include <sys/types.h>
726
+ #endif
727
+ #ifdef HAVE_SYS_SOCKET_H
728
+ #include <sys/socket.h>
729
+ #endif
730
+ #endif
731
+ ]],[[
732
+ int flag=MSG_NOSIGNAL;
733
+ ]])
734
+ ],[
735
+ curl_cv_msg_nosignal="yes"
736
+ ],[
737
+ curl_cv_msg_nosignal="no"
738
+ ])
739
+ ])
740
+ case "$curl_cv_msg_nosignal" in
741
+ yes)
742
+ AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1,
743
+ [Define to 1 if you have the MSG_NOSIGNAL flag.])
744
+ ;;
745
+ esac
746
+ ])
747
+
748
+
749
+ dnl CURL_CHECK_STRUCT_TIMEVAL
750
+ dnl -------------------------------------------------
751
+ dnl Check for timeval struct
752
+
753
+ AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
754
+ AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
755
+ AC_CHECK_HEADERS(sys/types.h sys/time.h sys/socket.h)
756
+ AC_CACHE_CHECK([for struct timeval], [curl_cv_struct_timeval], [
757
+ AC_COMPILE_IFELSE([
758
+ AC_LANG_PROGRAM([[
759
+ #undef inline
760
+ #ifdef _WIN32
761
+ #ifndef WIN32_LEAN_AND_MEAN
762
+ #define WIN32_LEAN_AND_MEAN
763
+ #endif
764
+ #include <winsock2.h>
765
+ #endif
766
+ #ifdef HAVE_SYS_TYPES_H
767
+ #include <sys/types.h>
768
+ #endif
769
+ #ifdef HAVE_SYS_TIME_H
770
+ #include <sys/time.h>
771
+ #endif
772
+ #include <time.h>
773
+ #ifdef HAVE_SYS_SOCKET_H
774
+ #include <sys/socket.h>
775
+ #endif
776
+ ]],[[
777
+ struct timeval ts;
778
+ ts.tv_sec = 0;
779
+ ts.tv_usec = 0;
780
+ ]])
781
+ ],[
782
+ curl_cv_struct_timeval="yes"
783
+ ],[
784
+ curl_cv_struct_timeval="no"
785
+ ])
786
+ ])
787
+ case "$curl_cv_struct_timeval" in
788
+ yes)
789
+ AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1,
790
+ [Define to 1 if you have the timeval struct.])
791
+ ;;
792
+ esac
793
+ ])
794
+
795
+
796
+ dnl TYPE_IN_ADDR_T
797
+ dnl -------------------------------------------------
798
+ dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
799
+ dnl and a few other things.
800
+
801
+ AC_DEFUN([TYPE_IN_ADDR_T], [
802
+ AC_CHECK_TYPE([in_addr_t], ,[
803
+ dnl in_addr_t not available
804
+ AC_CACHE_CHECK([for in_addr_t equivalent],
805
+ [curl_cv_in_addr_t_equiv], [
806
+ curl_cv_in_addr_t_equiv="unknown"
807
+ for t in "unsigned long" int size_t unsigned long; do
808
+ if test "$curl_cv_in_addr_t_equiv" = "unknown"; then
809
+ AC_LINK_IFELSE([
810
+ AC_LANG_PROGRAM([[
811
+ #undef inline
812
+ #ifdef _WIN32
813
+ #ifndef WIN32_LEAN_AND_MEAN
814
+ #define WIN32_LEAN_AND_MEAN
815
+ #endif
816
+ #include <winsock2.h>
817
+ #else
818
+ #ifdef HAVE_SYS_TYPES_H
819
+ #include <sys/types.h>
820
+ #endif
821
+ #ifdef HAVE_SYS_SOCKET_H
822
+ #include <sys/socket.h>
823
+ #endif
824
+ #ifdef HAVE_NETINET_IN_H
825
+ #include <netinet/in.h>
826
+ #endif
827
+ #ifdef HAVE_ARPA_INET_H
828
+ #include <arpa/inet.h>
829
+ #endif
830
+ #endif
831
+ ]],[[
832
+ $t data = inet_addr ("1.2.3.4");
833
+ ]])
834
+ ],[
835
+ curl_cv_in_addr_t_equiv="$t"
836
+ ])
837
+ fi
838
+ done
839
+ ])
840
+ case "$curl_cv_in_addr_t_equiv" in
841
+ unknown)
842
+ AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t])
843
+ ;;
844
+ *)
845
+ AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv,
846
+ [Type to use in place of in_addr_t when system does not provide it.])
847
+ ;;
848
+ esac
849
+ ],[
850
+ #undef inline
851
+ #ifdef _WIN32
852
+ #ifndef WIN32_LEAN_AND_MEAN
853
+ #define WIN32_LEAN_AND_MEAN
854
+ #endif
855
+ #include <winsock2.h>
856
+ #else
857
+ #ifdef HAVE_SYS_TYPES_H
858
+ #include <sys/types.h>
859
+ #endif
860
+ #ifdef HAVE_SYS_SOCKET_H
861
+ #include <sys/socket.h>
862
+ #endif
863
+ #ifdef HAVE_NETINET_IN_H
864
+ #include <netinet/in.h>
865
+ #endif
866
+ #ifdef HAVE_ARPA_INET_H
867
+ #include <arpa/inet.h>
868
+ #endif
869
+ #endif
870
+ ])
871
+ ])
872
+
873
+
874
+ dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC
875
+ dnl -------------------------------------------------
876
+ dnl Check if monotonic clock_gettime is available.
877
+
878
+ AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
879
+ AC_CHECK_HEADERS(sys/types.h sys/time.h)
880
+ AC_MSG_CHECKING([for monotonic clock_gettime])
881
+ #
882
+ if test "x$dontwant_rt" = "xno" ; then
883
+ AC_COMPILE_IFELSE([
884
+ AC_LANG_PROGRAM([[
885
+ #ifdef HAVE_SYS_TYPES_H
886
+ #include <sys/types.h>
887
+ #endif
888
+ #ifdef HAVE_SYS_TIME_H
889
+ #include <sys/time.h>
890
+ #endif
891
+ #include <time.h>
892
+ ]],[[
893
+ struct timespec ts;
894
+ (void)clock_gettime(CLOCK_MONOTONIC, &ts);
895
+ ]])
896
+ ],[
897
+ AC_MSG_RESULT([yes])
898
+ curl_func_clock_gettime="yes"
899
+ ],[
900
+ AC_MSG_RESULT([no])
901
+ curl_func_clock_gettime="no"
902
+ ])
903
+ fi
904
+ dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed
905
+ dnl until library linking and run-time checks for clock_gettime succeed.
906
+ ])
907
+
908
+ dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC_RAW
909
+ dnl -------------------------------------------------
910
+ dnl Check if monotonic clock_gettime is available.
911
+
912
+ AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC_RAW], [
913
+ AC_CHECK_HEADERS(sys/types.h sys/time.h)
914
+ AC_MSG_CHECKING([for raw monotonic clock_gettime])
915
+ #
916
+ if test "x$dontwant_rt" = "xno" ; then
917
+ AC_COMPILE_IFELSE([
918
+ AC_LANG_PROGRAM([[
919
+ #ifdef HAVE_SYS_TYPES_H
920
+ #include <sys/types.h>
921
+ #endif
922
+ #ifdef HAVE_SYS_TIME_H
923
+ #include <sys/time.h>
924
+ #endif
925
+ #include <time.h>
926
+ ]],[[
927
+ struct timespec ts;
928
+ (void)clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
929
+ ]])
930
+ ],[
931
+ AC_MSG_RESULT([yes])
932
+ AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC_RAW, 1,
933
+ [Define to 1 if you have the clock_gettime function and raw monotonic timer.])
934
+ ],[
935
+ AC_MSG_RESULT([no])
936
+ ])
937
+ fi
938
+ ])
939
+
940
+
941
+ dnl CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
942
+ dnl -------------------------------------------------
943
+ dnl If monotonic clock_gettime is available then,
944
+ dnl check and prepended to LIBS any needed libraries.
945
+
946
+ AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
947
+ AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])dnl
948
+ #
949
+ if test "$curl_func_clock_gettime" = "yes"; then
950
+ #
951
+ AC_MSG_CHECKING([for clock_gettime in libraries])
952
+ #
953
+ curl_cv_save_LIBS="$LIBS"
954
+ curl_cv_gclk_LIBS="unknown"
955
+ #
956
+ for x_xlibs in '' '-lrt' '-lposix4' ; do
957
+ if test "$curl_cv_gclk_LIBS" = "unknown"; then
958
+ if test -z "$x_xlibs"; then
959
+ LIBS="$curl_cv_save_LIBS"
960
+ else
961
+ LIBS="$x_xlibs $curl_cv_save_LIBS"
962
+ fi
963
+ AC_LINK_IFELSE([
964
+ AC_LANG_PROGRAM([[
965
+ #ifdef HAVE_SYS_TYPES_H
966
+ #include <sys/types.h>
967
+ #endif
968
+ #ifdef HAVE_SYS_TIME_H
969
+ #include <sys/time.h>
970
+ #endif
971
+ #include <time.h>
972
+ ]],[[
973
+ struct timespec ts;
974
+ (void)clock_gettime(CLOCK_MONOTONIC, &ts);
975
+ ]])
976
+ ],[
977
+ curl_cv_gclk_LIBS="$x_xlibs"
978
+ ])
979
+ fi
980
+ done
981
+ #
982
+ LIBS="$curl_cv_save_LIBS"
983
+ #
984
+ case X-"$curl_cv_gclk_LIBS" in
985
+ X-unknown)
986
+ AC_MSG_RESULT([cannot find clock_gettime])
987
+ AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
988
+ curl_func_clock_gettime="no"
989
+ ;;
990
+ X-)
991
+ AC_MSG_RESULT([no additional lib required])
992
+ curl_func_clock_gettime="yes"
993
+ ;;
994
+ *)
995
+ if test -z "$curl_cv_save_LIBS"; then
996
+ LIBS="$curl_cv_gclk_LIBS"
997
+ else
998
+ LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
999
+ fi
1000
+ AC_MSG_RESULT([$curl_cv_gclk_LIBS])
1001
+ curl_func_clock_gettime="yes"
1002
+ ;;
1003
+ esac
1004
+ #
1005
+ dnl only do runtime verification when not cross-compiling
1006
+ if test "x$cross_compiling" != "xyes" &&
1007
+ test "$curl_func_clock_gettime" = "yes"; then
1008
+ AC_MSG_CHECKING([if monotonic clock_gettime works])
1009
+ CURL_RUN_IFELSE([
1010
+ AC_LANG_PROGRAM([[
1011
+ #include <stdlib.h>
1012
+ #ifdef HAVE_SYS_TYPES_H
1013
+ #include <sys/types.h>
1014
+ #endif
1015
+ #ifdef HAVE_SYS_TIME_H
1016
+ #include <sys/time.h>
1017
+ #endif
1018
+ #include <time.h>
1019
+ ]],[[
1020
+ struct timespec ts;
1021
+ if (0 == clock_gettime(CLOCK_MONOTONIC, &ts))
1022
+ exit(0);
1023
+ else
1024
+ exit(1);
1025
+ ]])
1026
+ ],[
1027
+ AC_MSG_RESULT([yes])
1028
+ ],[
1029
+ AC_MSG_RESULT([no])
1030
+ AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
1031
+ curl_func_clock_gettime="no"
1032
+ LIBS="$curl_cv_save_LIBS"
1033
+ ])
1034
+ fi
1035
+ #
1036
+ case "$curl_func_clock_gettime" in
1037
+ yes)
1038
+ AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,
1039
+ [Define to 1 if you have the clock_gettime function and monotonic timer.])
1040
+ ;;
1041
+ esac
1042
+ #
1043
+ fi
1044
+ #
1045
+ ])
1046
+
1047
+
1048
+ dnl CURL_CHECK_LIBS_CONNECT
1049
+ dnl -------------------------------------------------
1050
+ dnl Verify if network connect function is already available
1051
+ dnl using current libraries or if another one is required.
1052
+
1053
+ AC_DEFUN([CURL_CHECK_LIBS_CONNECT], [
1054
+ AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
1055
+ AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
1056
+ AC_MSG_CHECKING([for connect in libraries])
1057
+ tst_connect_save_LIBS="$LIBS"
1058
+ tst_connect_need_LIBS="unknown"
1059
+ for tst_lib in '' '-lsocket' ; do
1060
+ if test "$tst_connect_need_LIBS" = "unknown"; then
1061
+ LIBS="$tst_lib $tst_connect_save_LIBS"
1062
+ AC_LINK_IFELSE([
1063
+ AC_LANG_PROGRAM([[
1064
+ $curl_includes_winsock2
1065
+ $curl_includes_bsdsocket
1066
+ #if !defined(_WIN32) && !defined(HAVE_PROTO_BSDSOCKET_H)
1067
+ int connect(int, void*, int);
1068
+ #endif
1069
+ ]],[[
1070
+ if(0 != connect(0, 0, 0))
1071
+ return 1;
1072
+ ]])
1073
+ ],[
1074
+ tst_connect_need_LIBS="$tst_lib"
1075
+ ])
1076
+ fi
1077
+ done
1078
+ LIBS="$tst_connect_save_LIBS"
1079
+ #
1080
+ case X-"$tst_connect_need_LIBS" in
1081
+ X-unknown)
1082
+ AC_MSG_RESULT([cannot find connect])
1083
+ AC_MSG_ERROR([cannot find connect function in libraries.])
1084
+ ;;
1085
+ X-)
1086
+ AC_MSG_RESULT([yes])
1087
+ ;;
1088
+ *)
1089
+ AC_MSG_RESULT([$tst_connect_need_LIBS])
1090
+ LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS"
1091
+ ;;
1092
+ esac
1093
+ ])
1094
+
1095
+
1096
+ dnl CURL_CHECK_FUNC_SELECT
1097
+ dnl -------------------------------------------------
1098
+ dnl Test if the socket select() function is available.
1099
+
1100
+ AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
1101
+ AC_REQUIRE([CURL_CHECK_STRUCT_TIMEVAL])dnl
1102
+ AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
1103
+ AC_CHECK_HEADERS(sys/select.h sys/socket.h)
1104
+ #
1105
+ AC_MSG_CHECKING([for select])
1106
+ AC_LINK_IFELSE([
1107
+ AC_LANG_PROGRAM([[
1108
+ #undef inline
1109
+ #ifdef _WIN32
1110
+ #ifndef WIN32_LEAN_AND_MEAN
1111
+ #define WIN32_LEAN_AND_MEAN
1112
+ #endif
1113
+ #include <winsock2.h>
1114
+ #endif
1115
+ #ifdef HAVE_SYS_TYPES_H
1116
+ #include <sys/types.h>
1117
+ #endif
1118
+ #ifdef HAVE_SYS_TIME_H
1119
+ #include <sys/time.h>
1120
+ #endif
1121
+ #include <time.h>
1122
+ #ifndef _WIN32
1123
+ #ifdef HAVE_SYS_SELECT_H
1124
+ #include <sys/select.h>
1125
+ #elif defined(HAVE_UNISTD_H)
1126
+ #include <unistd.h>
1127
+ #endif
1128
+ #ifdef HAVE_SYS_SOCKET_H
1129
+ #include <sys/socket.h>
1130
+ #endif
1131
+ $curl_includes_bsdsocket
1132
+ #endif
1133
+ ]],[[
1134
+ select(0, 0, 0, 0, 0);
1135
+ ]])
1136
+ ],[
1137
+ AC_MSG_RESULT([yes])
1138
+ curl_cv_select="yes"
1139
+ ],[
1140
+ AC_MSG_RESULT([no])
1141
+ curl_cv_select="no"
1142
+ ])
1143
+ #
1144
+ if test "$curl_cv_select" = "yes"; then
1145
+ AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
1146
+ [Define to 1 if you have the select function.])
1147
+ curl_cv_func_select="yes"
1148
+ fi
1149
+ ])
1150
+
1151
+
1152
+ dnl CURL_VERIFY_RUNTIMELIBS
1153
+ dnl -------------------------------------------------
1154
+ dnl Verify that the shared libs found so far can be used when running
1155
+ dnl programs, since otherwise the situation will create odd configure errors
1156
+ dnl that are misleading people.
1157
+ dnl
1158
+ dnl Make sure this test is run BEFORE the first test in the script that
1159
+ dnl runs anything, which at the time of this writing is the AC_CHECK_SIZEOF
1160
+ dnl macro. It must also run AFTER all lib-checking macros are complete.
1161
+
1162
+ AC_DEFUN([CURL_VERIFY_RUNTIMELIBS], [
1163
+
1164
+ dnl this test is of course not sensible if we are cross-compiling!
1165
+ if test "x$cross_compiling" != xyes; then
1166
+
1167
+ dnl just run a program to verify that the libs checked for previous to this
1168
+ dnl point also is available run-time!
1169
+ AC_MSG_CHECKING([run-time libs availability])
1170
+ CURL_RUN_IFELSE([
1171
+ int main()
1172
+ {
1173
+ return 0;
1174
+ }
1175
+ ],
1176
+ AC_MSG_RESULT([fine]),
1177
+ AC_MSG_RESULT([failed])
1178
+ AC_MSG_ERROR([one or more libs available at link-time are not available run-time. Libs used at link-time: $LIBS])
1179
+ )
1180
+
1181
+ dnl if this test fails, configure has already stopped
1182
+ fi
1183
+ ])
1184
+
1185
+
1186
+ dnl CURL_CHECK_CA_BUNDLE
1187
+ dnl -------------------------------------------------
1188
+ dnl Check if a default ca-bundle should be used
1189
+ dnl
1190
+ dnl regarding the paths this will scan:
1191
+ dnl /etc/ssl/certs/ca-certificates.crt Debian systems
1192
+ dnl /etc/pki/tls/certs/ca-bundle.crt Redhat and Mandriva
1193
+ dnl /usr/share/ssl/certs/ca-bundle.crt old(er) Redhat
1194
+ dnl /usr/local/share/certs/ca-root-nss.crt MidnightBSD
1195
+ dnl /etc/ssl/cert.pem OpenBSD, MidnightBSD (symlink)
1196
+ dnl /etc/ssl/certs (CA path) SUSE, FreeBSD
1197
+
1198
+ AC_DEFUN([CURL_CHECK_CA_BUNDLE], [
1199
+
1200
+ AC_MSG_CHECKING([default CA cert bundle/path])
1201
+
1202
+ AC_ARG_WITH(ca-bundle,
1203
+ AS_HELP_STRING([--with-ca-bundle=FILE],
1204
+ [Absolute path to a file containing CA certificates (example: /etc/ca-bundle.crt)])
1205
+ AS_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]),
1206
+ [
1207
+ want_ca="$withval"
1208
+ if test "x$want_ca" = "xyes"; then
1209
+ AC_MSG_ERROR([--with-ca-bundle=FILE requires a path to the CA bundle])
1210
+ fi
1211
+ ],
1212
+ [ want_ca="unset" ])
1213
+ AC_ARG_WITH(ca-path,
1214
+ AS_HELP_STRING([--with-ca-path=DIRECTORY],
1215
+ [Absolute path to a directory containing CA certificates stored individually, with \
1216
+ their filenames in a hash format. This option can be used with the OpenSSL, \
1217
+ GnuTLS, mbedTLS and wolfSSL backends. Refer to OpenSSL c_rehash for details. \
1218
+ (example: /etc/certificates)])
1219
+ AS_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
1220
+ [
1221
+ want_capath="$withval"
1222
+ if test "x$want_capath" = "xyes"; then
1223
+ AC_MSG_ERROR([--with-ca-path=DIRECTORY requires a path to the CA path directory])
1224
+ fi
1225
+ ],
1226
+ [ want_capath="unset"])
1227
+
1228
+ ca_warning=" (warning: certs not found)"
1229
+ capath_warning=" (warning: certs not found)"
1230
+ check_capath=""
1231
+
1232
+ if test "x$want_ca" != "xno" -a "x$want_ca" != "xunset" -a \
1233
+ "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
1234
+ dnl both given
1235
+ ca="$want_ca"
1236
+ capath="$want_capath"
1237
+ elif test "x$want_ca" != "xno" -a "x$want_ca" != "xunset"; then
1238
+ dnl --with-ca-bundle given
1239
+ ca="$want_ca"
1240
+ capath="no"
1241
+ elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
1242
+ dnl --with-ca-path given
1243
+ capath="$want_capath"
1244
+ ca="no"
1245
+ else
1246
+ dnl First try auto-detecting a CA bundle, then a CA path.
1247
+ dnl Both auto-detections can be skipped by --without-ca-*
1248
+ ca="no"
1249
+ capath="no"
1250
+ if test "x$cross_compiling" != "xyes" -a \
1251
+ "x$curl_cv_native_windows" != "xyes"; then
1252
+ dnl NOT cross-compiling and...
1253
+ dnl neither of the --with-ca-* options are provided
1254
+ if test "x$want_ca" = "xunset"; then
1255
+ dnl the path we previously would have installed the curl CA bundle
1256
+ dnl to, and thus we now check for an already existing cert in that
1257
+ dnl place in case we find no other
1258
+ if test "x$prefix" != xNONE; then
1259
+ cac="${prefix}/share/curl/curl-ca-bundle.crt"
1260
+ else
1261
+ cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
1262
+ fi
1263
+
1264
+ for a in /etc/ssl/certs/ca-certificates.crt \
1265
+ /etc/pki/tls/certs/ca-bundle.crt \
1266
+ /usr/share/ssl/certs/ca-bundle.crt \
1267
+ /usr/local/share/certs/ca-root-nss.crt \
1268
+ /etc/ssl/cert.pem \
1269
+ "$cac"; do
1270
+ if test -f "$a"; then
1271
+ ca="$a"
1272
+ break
1273
+ fi
1274
+ done
1275
+ fi
1276
+ AC_MSG_NOTICE([want $want_capath ca $ca])
1277
+ if test "x$want_capath" = "xunset"; then
1278
+ check_capath="/etc/ssl/certs"
1279
+ fi
1280
+ else
1281
+ dnl no option given and cross-compiling
1282
+ AC_MSG_WARN([skipped the ca-cert path detection when cross-compiling])
1283
+ fi
1284
+ fi
1285
+
1286
+ if test "x$ca" = "xno" || test -f "$ca"; then
1287
+ ca_warning=""
1288
+ fi
1289
+
1290
+ if test "x$capath" != "xno"; then
1291
+ check_capath="$capath"
1292
+ fi
1293
+
1294
+ if test ! -z "$check_capath"; then
1295
+ for a in "$check_capath"; do
1296
+ if test -d "$a" && ls "$a"/[[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]].0 >/dev/null 2>/dev/null; then
1297
+ if test "x$capath" = "xno"; then
1298
+ capath="$a"
1299
+ fi
1300
+ capath_warning=""
1301
+ break
1302
+ fi
1303
+ done
1304
+ fi
1305
+
1306
+ if test "x$capath" = "xno"; then
1307
+ capath_warning=""
1308
+ fi
1309
+
1310
+ if test "x$ca" != "xno"; then
1311
+ CURL_CA_BUNDLE="$ca"
1312
+ AC_DEFINE_UNQUOTED(CURL_CA_BUNDLE, "$ca", [Location of default ca bundle])
1313
+ AC_SUBST(CURL_CA_BUNDLE)
1314
+ AC_MSG_RESULT([$ca])
1315
+ fi
1316
+ if test "x$capath" != "xno"; then
1317
+ CURL_CA_PATH="\"$capath\""
1318
+ AC_DEFINE_UNQUOTED(CURL_CA_PATH, "$capath", [Location of default ca path])
1319
+ AC_MSG_RESULT([$capath (capath)])
1320
+ fi
1321
+ if test "x$ca" = "xno" && test "x$capath" = "xno"; then
1322
+ AC_MSG_RESULT([no])
1323
+ fi
1324
+
1325
+ AC_MSG_CHECKING([whether to use built-in CA store of SSL library])
1326
+ AC_ARG_WITH(ca-fallback,
1327
+ AS_HELP_STRING([--with-ca-fallback], [Use the built-in CA store of the SSL library])
1328
+ AS_HELP_STRING([--without-ca-fallback], [Don't use the built-in CA store of the SSL library]),
1329
+ [
1330
+ if test "x$with_ca_fallback" != "xyes" -a "x$with_ca_fallback" != "xno"; then
1331
+ AC_MSG_ERROR([--with-ca-fallback only allows yes or no as parameter])
1332
+ fi
1333
+ ],
1334
+ [ with_ca_fallback="no"])
1335
+ AC_MSG_RESULT([$with_ca_fallback])
1336
+ if test "x$with_ca_fallback" = "xyes"; then
1337
+ if test "x$OPENSSL_ENABLED" != "x1" -a "x$GNUTLS_ENABLED" != "x1"; then
1338
+ AC_MSG_ERROR([--with-ca-fallback only works with OpenSSL or GnuTLS])
1339
+ fi
1340
+ AC_DEFINE_UNQUOTED(CURL_CA_FALLBACK, 1, [define "1" to use built-in CA store of SSL library])
1341
+ fi
1342
+ ])
1343
+
1344
+
1345
+ dnl CURL_CHECK_CA_EMBED
1346
+ dnl -------------------------------------------------
1347
+ dnl Check if a ca-bundle should be embedded
1348
+
1349
+ AC_DEFUN([CURL_CHECK_CA_EMBED], [
1350
+
1351
+ AC_MSG_CHECKING([CA cert bundle path to embed in the curl tool])
1352
+
1353
+ AC_ARG_WITH(ca-embed,
1354
+ AS_HELP_STRING([--with-ca-embed=FILE],
1355
+ [Absolute path to a file containing CA certificates to embed in the curl tool (example: /etc/ca-bundle.crt)])
1356
+ AS_HELP_STRING([--without-ca-embed], [Don't embed a default CA bundle in the curl tool]),
1357
+ [
1358
+ want_ca_embed="$withval"
1359
+ if test "x$want_ca_embed" = "xyes"; then
1360
+ AC_MSG_ERROR([--with-ca-embed=FILE requires a path to the CA bundle])
1361
+ fi
1362
+ ],
1363
+ [ want_ca_embed="unset" ])
1364
+
1365
+ CURL_CA_EMBED=''
1366
+ if test "x$want_ca_embed" != "xno" -a "x$want_ca_embed" != "xunset" -a -f "$want_ca_embed"; then
1367
+ CURL_CA_EMBED="$want_ca_embed"
1368
+ AC_SUBST(CURL_CA_EMBED)
1369
+ AC_MSG_RESULT([$want_ca_embed])
1370
+ else
1371
+ AC_MSG_RESULT([no])
1372
+ fi
1373
+ ])
1374
+
1375
+ dnl CURL_CHECK_WIN32_LARGEFILE
1376
+ dnl -------------------------------------------------
1377
+ dnl Check if curl's Win32 large file will be used
1378
+
1379
+ AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [
1380
+ AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
1381
+ AC_MSG_CHECKING([whether build target supports Win32 file API])
1382
+ curl_win32_file_api="no"
1383
+ if test "$curl_cv_native_windows" = "yes"; then
1384
+ if test x"$enable_largefile" != "xno"; then
1385
+ AC_COMPILE_IFELSE([
1386
+ AC_LANG_PROGRAM([[
1387
+ ]],[[
1388
+ #if !defined(_WIN32_WCE) && (defined(__MINGW32__) || defined(_MSC_VER))
1389
+ int dummy=1;
1390
+ #else
1391
+ #error Win32 large file API not supported.
1392
+ #endif
1393
+ ]])
1394
+ ],[
1395
+ curl_win32_file_api="win32_large_files"
1396
+ ])
1397
+ fi
1398
+ if test "$curl_win32_file_api" = "no"; then
1399
+ AC_COMPILE_IFELSE([
1400
+ AC_LANG_PROGRAM([[
1401
+ ]],[[
1402
+ #if defined(_WIN32_WCE) || defined(__MINGW32__) || defined(_MSC_VER)
1403
+ int dummy=1;
1404
+ #else
1405
+ #error Win32 small file API not supported.
1406
+ #endif
1407
+ ]])
1408
+ ],[
1409
+ curl_win32_file_api="win32_small_files"
1410
+ ])
1411
+ fi
1412
+ fi
1413
+ case "$curl_win32_file_api" in
1414
+ win32_large_files)
1415
+ AC_MSG_RESULT([yes (large file enabled)])
1416
+ AC_DEFINE_UNQUOTED(USE_WIN32_LARGE_FILES, 1,
1417
+ [Define to 1 if you are building a Windows target with large file support.])
1418
+ AC_SUBST(USE_WIN32_LARGE_FILES, [1])
1419
+ ;;
1420
+ win32_small_files)
1421
+ AC_MSG_RESULT([yes (large file disabled)])
1422
+ AC_DEFINE_UNQUOTED(USE_WIN32_SMALL_FILES, 1,
1423
+ [Define to 1 if you are building a Windows target without large file support.])
1424
+ AC_SUBST(USE_WIN32_SMALL_FILES, [1])
1425
+ ;;
1426
+ *)
1427
+ AC_MSG_RESULT([no])
1428
+ ;;
1429
+ esac
1430
+ ])
1431
+
1432
+ dnl CURL_CHECK_WIN32_CRYPTO
1433
+ dnl -------------------------------------------------
1434
+ dnl Check if curl's Win32 crypto lib can be used
1435
+
1436
+ AC_DEFUN([CURL_CHECK_WIN32_CRYPTO], [
1437
+ AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
1438
+ AC_MSG_CHECKING([whether build target supports Win32 crypto API])
1439
+ curl_win32_crypto_api="no"
1440
+ if test "$curl_cv_native_windows" = "yes"; then
1441
+ AC_COMPILE_IFELSE([
1442
+ AC_LANG_PROGRAM([[
1443
+ #undef inline
1444
+ #ifndef WIN32_LEAN_AND_MEAN
1445
+ #define WIN32_LEAN_AND_MEAN
1446
+ #endif
1447
+ #include <windows.h>
1448
+ #include <wincrypt.h>
1449
+ ]],[[
1450
+ HCRYPTPROV hCryptProv;
1451
+ if(CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL,
1452
+ CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
1453
+ CryptReleaseContext(hCryptProv, 0);
1454
+ }
1455
+ ]])
1456
+ ],[
1457
+ curl_win32_crypto_api="yes"
1458
+ ])
1459
+ fi
1460
+ case "$curl_win32_crypto_api" in
1461
+ yes)
1462
+ AC_MSG_RESULT([yes])
1463
+ AC_DEFINE_UNQUOTED(USE_WIN32_CRYPTO, 1,
1464
+ [Define to 1 if you are building a Windows target with crypto API support.])
1465
+ AC_SUBST(USE_WIN32_CRYPTO, [1])
1466
+ ;;
1467
+ *)
1468
+ AC_MSG_RESULT([no])
1469
+ ;;
1470
+ esac
1471
+ ])
1472
+
1473
+ dnl CURL_EXPORT_PCDIR ($pcdir)
1474
+ dnl ------------------------
1475
+ dnl if $pcdir is not empty, set PKG_CONFIG_LIBDIR to $pcdir and export
1476
+ dnl
1477
+ dnl we need this macro since pkg-config distinguishes among empty and unset
1478
+ dnl variable while checking PKG_CONFIG_LIBDIR
1479
+ dnl
1480
+
1481
+ AC_DEFUN([CURL_EXPORT_PCDIR], [
1482
+ if test -n "$1"; then
1483
+ PKG_CONFIG_LIBDIR="$1"
1484
+ export PKG_CONFIG_LIBDIR
1485
+ fi
1486
+ ])
1487
+
1488
+ dnl CURL_CHECK_PKGCONFIG ($module, [$pcdir])
1489
+ dnl ------------------------
1490
+ dnl search for the pkg-config tool. Set the PKGCONFIG variable to hold the
1491
+ dnl path to it, or 'no' if not found/present.
1492
+ dnl
1493
+ dnl If pkg-config is present, check that it has info about the $module or
1494
+ dnl return "no" anyway!
1495
+ dnl
1496
+ dnl Optionally PKG_CONFIG_LIBDIR may be given as $pcdir.
1497
+ dnl
1498
+
1499
+ AC_DEFUN([CURL_CHECK_PKGCONFIG], [
1500
+ if test -n "$PKG_CONFIG"; then
1501
+ PKGCONFIG="$PKG_CONFIG"
1502
+ else
1503
+ AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no],
1504
+ [$PATH:/usr/bin:/usr/local/bin])
1505
+ fi
1506
+
1507
+ if test "x$PKGCONFIG" != "xno"; then
1508
+ AC_MSG_CHECKING([for $1 options with pkg-config])
1509
+ dnl ask pkg-config about $1
1510
+ itexists=`CURL_EXPORT_PCDIR([$2]) dnl
1511
+ $PKGCONFIG --exists $1 >/dev/null 2>&1 && echo 1`
1512
+
1513
+ if test -z "$itexists"; then
1514
+ dnl pkg-config does not have info about the given module! set the
1515
+ dnl variable to 'no'
1516
+ PKGCONFIG="no"
1517
+ AC_MSG_RESULT([no])
1518
+ else
1519
+ AC_MSG_RESULT([found])
1520
+ fi
1521
+ fi
1522
+ ])
1523
+
1524
+
1525
+ dnl CURL_PREPARE_CONFIGUREHELP_PM
1526
+ dnl -------------------------------------------------
1527
+ dnl Prepare test harness configurehelp.pm module, defining and
1528
+ dnl initializing some perl variables with values which are known
1529
+ dnl when the configure script runs. For portability reasons, test
1530
+ dnl harness needs information on how to run the C preprocessor.
1531
+
1532
+ AC_DEFUN([CURL_PREPARE_CONFIGUREHELP_PM], [
1533
+ AC_REQUIRE([AC_PROG_CPP])dnl
1534
+ tmp_cpp=`eval echo "$ac_cpp" 2>/dev/null`
1535
+ if test -z "$tmp_cpp"; then
1536
+ tmp_cpp='cpp'
1537
+ fi
1538
+ AC_SUBST(CURL_CPP, $tmp_cpp)
1539
+ ])
1540
+
1541
+
1542
+ dnl CURL_PREPARE_BUILDINFO
1543
+ dnl -------------------------------------------------
1544
+ dnl Save build info for test runner to pick up and log
1545
+
1546
+ AC_DEFUN([CURL_PREPARE_BUILDINFO], [
1547
+ curl_pflags=""
1548
+ case $host in
1549
+ *-apple-*) curl_pflags="${curl_pflags} APPLE";;
1550
+ esac
1551
+ if test "$curl_cv_native_windows" = 'yes'; then
1552
+ curl_pflags="${curl_pflags} WIN32"
1553
+ else
1554
+ case $host in
1555
+ *-*-*bsd*|*-*-aix*|*-*-hpux*|*-*-interix*|*-*-irix*|*-*-linux*|*-*-solaris*|*-*-sunos*|*-apple-*|*-*-cygwin*|*-*-msys*)
1556
+ curl_pflags="${curl_pflags} UNIX";;
1557
+ esac
1558
+ case $host in
1559
+ *-*-*bsd*)
1560
+ curl_pflags="${curl_pflags} BSD";;
1561
+ esac
1562
+ fi
1563
+ if test "$curl_cv_cygwin" = 'yes'; then
1564
+ curl_pflags="${curl_pflags} CYGWIN"
1565
+ fi
1566
+ case $host_os in
1567
+ msys*) curl_pflags="${curl_pflags} MSYS";;
1568
+ esac
1569
+ if test "x$compiler_id" = 'xGNU_C'; then
1570
+ curl_pflags="${curl_pflags} GCC"
1571
+ fi
1572
+ case $host_os in
1573
+ mingw*) curl_pflags="${curl_pflags} MINGW";;
1574
+ esac
1575
+ if test "x$cross_compiling" = 'xyes'; then
1576
+ curl_pflags="${curl_pflags} CROSS"
1577
+ fi
1578
+ squeeze curl_pflags
1579
+ curl_buildinfo="
1580
+ buildinfo.configure.tool: configure
1581
+ buildinfo.configure.args: $ac_configure_args
1582
+ buildinfo.host: $build
1583
+ buildinfo.host.cpu: $build_cpu
1584
+ buildinfo.host.os: $build_os
1585
+ buildinfo.target: $host
1586
+ buildinfo.target.cpu: $host_cpu
1587
+ buildinfo.target.os: $host_os
1588
+ buildinfo.target.flags: $curl_pflags
1589
+ buildinfo.compiler: $compiler_id
1590
+ buildinfo.compiler.version: $compiler_ver
1591
+ buildinfo.sysroot: $lt_sysroot"
1592
+ ])
1593
+
1594
+
1595
+ dnl CURL_CPP_P
1596
+ dnl
1597
+ dnl Check if $cpp -P should be used for extract define values due to gcc 5
1598
+ dnl splitting up strings and defines between line outputs. gcc by default
1599
+ dnl (without -P) will show TEST EINVAL TEST as
1600
+ dnl
1601
+ dnl # 13 "conftest.c"
1602
+ dnl TEST
1603
+ dnl # 13 "conftest.c" 3 4
1604
+ dnl 22
1605
+ dnl # 13 "conftest.c"
1606
+ dnl TEST
1607
+
1608
+ AC_DEFUN([CURL_CPP_P], [
1609
+ AC_MSG_CHECKING([if cpp -P is needed])
1610
+ AC_EGREP_CPP([TEST.*TEST], [
1611
+ #include <errno.h>
1612
+ TEST EINVAL TEST
1613
+ ], [cpp=no], [cpp=yes])
1614
+ AC_MSG_RESULT([$cpp])
1615
+
1616
+ dnl we need cpp -P so check if it works then
1617
+ if test "x$cpp" = "xyes"; then
1618
+ AC_MSG_CHECKING([if cpp -P works])
1619
+ OLDCPPFLAGS=$CPPFLAGS
1620
+ CPPFLAGS="$CPPFLAGS -P"
1621
+ AC_EGREP_CPP([TEST.*TEST], [
1622
+ #include <errno.h>
1623
+ TEST EINVAL TEST
1624
+ ], [cpp_p=yes], [cpp_p=no])
1625
+ AC_MSG_RESULT([$cpp_p])
1626
+
1627
+ if test "x$cpp_p" = "xno"; then
1628
+ AC_MSG_WARN([failed to figure out cpp -P alternative])
1629
+ # without -P
1630
+ CPPPFLAG=""
1631
+ else
1632
+ # with -P
1633
+ CPPPFLAG="-P"
1634
+ fi
1635
+ dnl restore CPPFLAGS
1636
+ CPPFLAGS=$OLDCPPFLAGS
1637
+ else
1638
+ # without -P
1639
+ CPPPFLAG=""
1640
+ fi
1641
+ ])
1642
+
1643
+
1644
+ dnl CURL_DARWIN_CFLAGS
1645
+ dnl
1646
+ dnl Set -Werror=partial-availability to detect possible breaking code
1647
+ dnl with very low deployment targets.
1648
+ dnl
1649
+
1650
+ AC_DEFUN([CURL_DARWIN_CFLAGS], [
1651
+
1652
+ tst_cflags="no"
1653
+ case $host in
1654
+ *-apple-*)
1655
+ tst_cflags="yes"
1656
+ ;;
1657
+ esac
1658
+
1659
+ AC_MSG_CHECKING([for good-to-use Darwin CFLAGS])
1660
+ AC_MSG_RESULT([$tst_cflags]);
1661
+
1662
+ if test "$tst_cflags" = "yes"; then
1663
+ old_CFLAGS=$CFLAGS
1664
+ CFLAGS="$CFLAGS -Werror=partial-availability"
1665
+ AC_MSG_CHECKING([whether $CC accepts -Werror=partial-availability])
1666
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
1667
+ [AC_MSG_RESULT([yes])],
1668
+ [AC_MSG_RESULT([no])
1669
+ CFLAGS=$old_CFLAGS])
1670
+ fi
1671
+
1672
+ ])
1673
+
1674
+
1675
+ dnl CURL_SUPPORTS_BUILTIN_AVAILABLE
1676
+ dnl
1677
+ dnl Check to see if the compiler supports __builtin_available. This built-in
1678
+ dnl compiler function first appeared in Apple LLVM 9.0.0. It's so new that, at
1679
+ dnl the time this macro was written, the function was not yet documented. Its
1680
+ dnl purpose is to return true if the code is running under a certain OS version
1681
+ dnl or later.
1682
+
1683
+ AC_DEFUN([CURL_SUPPORTS_BUILTIN_AVAILABLE], [
1684
+ AC_MSG_CHECKING([to see if the compiler supports __builtin_available()])
1685
+ AC_COMPILE_IFELSE([
1686
+ AC_LANG_PROGRAM([[
1687
+ ]],[[
1688
+ if(__builtin_available(macOS 10.12, iOS 5.0, *)) {}
1689
+ ]])
1690
+ ],[
1691
+ AC_MSG_RESULT([yes])
1692
+ AC_DEFINE_UNQUOTED(HAVE_BUILTIN_AVAILABLE, 1,
1693
+ [Define to 1 if you have the __builtin_available function.])
1694
+ ],[
1695
+ AC_MSG_RESULT([no])
1696
+ ])
1697
+ ])
local-test-curl-delta-01/afc-curl/appveyor.sh ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ #***************************************************************************
3
+ # _ _ ____ _
4
+ # Project ___| | | | _ \| |
5
+ # / __| | | | |_) | |
6
+ # | (__| |_| | _ <| |___
7
+ # \___|\___/|_| \_\_____|
8
+ #
9
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
10
+ #
11
+ # This software is licensed as described in the file COPYING, which
12
+ # you should have received as part of this distribution. The terms
13
+ # are also available at https://curl.se/docs/copyright.html.
14
+ #
15
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
16
+ # copies of the Software, and permit persons to whom the Software is
17
+ # furnished to do so, under the terms of the COPYING file.
18
+ #
19
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20
+ # KIND, either express or implied.
21
+ #
22
+ # SPDX-License-Identifier: curl
23
+ #
24
+ ###########################################################################
25
+
26
+ # shellcheck disable=SC3040,SC2039
27
+ set -eux; [ -n "${BASH:-}${ZSH_NAME:-}" ] && set -o pipefail
28
+
29
+ # build
30
+
31
+ if [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2022' ]; then
32
+ openssl_root_win='C:/OpenSSL-v33-Win64'
33
+ else
34
+ openssl_root_win='C:/OpenSSL-v111-Win64'
35
+ fi
36
+ openssl_root="$(cygpath "${openssl_root_win}")"
37
+
38
+ if [ "${BUILD_SYSTEM}" = 'CMake' ]; then
39
+ options=''
40
+ [[ "${TARGET:-}" = *'ARM64'* ]] && SKIP_RUN='ARM64 architecture'
41
+ [ -n "${TOOLSET:-}" ] && options+=" -T ${TOOLSET}"
42
+ [ "${OPENSSL}" = 'ON' ] && options+=" -DOPENSSL_ROOT_DIR=${openssl_root_win}"
43
+ [ -n "${CURLDEBUG:-}" ] && options+=" -DENABLE_CURLDEBUG=${CURLDEBUG}"
44
+ [ "${PRJ_CFG}" = 'Debug' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG='
45
+ [ "${PRJ_CFG}" = 'Release' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE='
46
+ [[ "${PRJ_GEN}" = *'Visual Studio'* ]] && options+=' -DCMAKE_VS_GLOBALS=TrackFileAccess=false'
47
+ if [ "${PRJ_GEN}" = 'Visual Studio 9 2008' ]; then
48
+ [ "${DEBUG}" = 'ON' ] && [ "${SHARED}" = 'ON' ] && SKIP_RUN='Crash on startup in ENABLE_DEBUG=ON shared builds'
49
+ # Fails to run without this due to missing MSVCR90.dll / MSVCR90D.dll
50
+ options+=' -DCURL_STATIC_CRT=ON'
51
+ fi
52
+ # shellcheck disable=SC2086
53
+ cmake -B _bld "-G${PRJ_GEN}" ${TARGET:-} ${options} \
54
+ "-DCURL_USE_OPENSSL=${OPENSSL}" \
55
+ "-DCURL_USE_SCHANNEL=${SCHANNEL}" \
56
+ "-DHTTP_ONLY=${HTTP_ONLY}" \
57
+ "-DBUILD_SHARED_LIBS=${SHARED}" \
58
+ "-DCMAKE_UNITY_BUILD=${UNITY}" \
59
+ '-DCURL_TEST_BUNDLES=ON' \
60
+ '-DCURL_WERROR=ON' \
61
+ "-DENABLE_DEBUG=${DEBUG}" \
62
+ "-DENABLE_UNICODE=${ENABLE_UNICODE}" \
63
+ '-DCMAKE_INSTALL_PREFIX=C:/curl' \
64
+ "-DCMAKE_BUILD_TYPE=${PRJ_CFG}" \
65
+ '-DCURL_USE_LIBPSL=OFF'
66
+ if false; then
67
+ cat _bld/CMakeFiles/CMakeConfigureLog.yaml 2>/dev/null || true
68
+ fi
69
+ echo 'curl_config.h'; grep -F '#define' _bld/lib/curl_config.h | sort || true
70
+ # shellcheck disable=SC2086
71
+ if ! cmake --build _bld --config "${PRJ_CFG}" --parallel 2 -- ${BUILD_OPT:-}; then
72
+ if [ "${PRJ_GEN}" = 'Visual Studio 9 2008' ]; then
73
+ find . -name BuildLog.htm -exec dos2unix '{}' +
74
+ find . -name BuildLog.htm -exec cat '{}' +
75
+ fi
76
+ false
77
+ fi
78
+ if [ "${SHARED}" = 'ON' ]; then
79
+ PATH="$PWD/_bld/lib:$PATH"
80
+ fi
81
+ if [ "${OPENSSL}" = 'ON' ]; then
82
+ PATH="$PWD/_bld/lib:${openssl_root}:$PATH"
83
+ fi
84
+ curl='_bld/src/curl.exe'
85
+ elif [ "${BUILD_SYSTEM}" = 'VisualStudioSolution' ]; then
86
+ (
87
+ cd projects
88
+ ./generate.bat "${VC_VERSION}"
89
+ msbuild.exe -maxcpucount "-property:Configuration=${PRJ_CFG}" "Windows/${VC_VERSION}/curl-all.sln"
90
+ )
91
+ curl="build/Win32/${VC_VERSION}/${PRJ_CFG}/curld.exe"
92
+ elif [ "${BUILD_SYSTEM}" = 'winbuild_vs2015' ]; then
93
+ ./buildconf.bat
94
+ (
95
+ cd winbuild
96
+ cat << EOF > _make.bat
97
+ call "C:/Program Files/Microsoft SDKs/Windows/v7.1/Bin/SetEnv.cmd" /x64
98
+ call "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/vcvarsall.bat" x86_amd64
99
+ nmake -f Makefile.vc mode=dll VC=14 "SSL_PATH=${openssl_root_win}" WITH_SSL=dll MACHINE=x64 DEBUG=${DEBUG} ENABLE_UNICODE=${ENABLE_UNICODE}
100
+ EOF
101
+ ./_make.bat
102
+ rm _make.bat
103
+ )
104
+ curl="builds/libcurl-vc14-x64-${PATHPART}-dll-ssl-dll-ipv6-sspi/bin/curl.exe"
105
+ elif [ "${BUILD_SYSTEM}" = 'winbuild_vs2017' ]; then
106
+ ./buildconf.bat
107
+ (
108
+ cd winbuild
109
+ cat << EOF > _make.bat
110
+ call "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvars64.bat"
111
+ nmake -f Makefile.vc mode=dll VC=14.10 "SSL_PATH=${openssl_root_win}" WITH_SSL=dll MACHINE=x64 DEBUG=${DEBUG} ENABLE_UNICODE=${ENABLE_UNICODE}
112
+ EOF
113
+ ./_make.bat
114
+ rm _make.bat
115
+ )
116
+ curl="builds/libcurl-vc14.10-x64-${PATHPART}-dll-ssl-dll-ipv6-sspi/bin/curl.exe"
117
+ fi
118
+
119
+ find . -name '*.exe' -o -name '*.dll'
120
+ if [ -z "${SKIP_RUN:-}" ]; then
121
+ "${curl}" --disable --version
122
+ else
123
+ echo "Skip running curl.exe. Reason: ${SKIP_RUN}"
124
+ fi
125
+
126
+ # build tests
127
+
128
+ if [[ "${TFLAGS}" != 'skipall' ]] && \
129
+ [ "${BUILD_SYSTEM}" = 'CMake' ]; then
130
+ cmake --build _bld --config "${PRJ_CFG}" --parallel 2 --target testdeps
131
+ fi
132
+
133
+ # run tests
134
+
135
+ if [[ "${TFLAGS}" != 'skipall' ]] && \
136
+ [[ "${TFLAGS}" != 'skiprun' ]]; then
137
+ if [ -x "$(cygpath "${SYSTEMROOT}/System32/curl.exe")" ]; then
138
+ TFLAGS+=" -ac $(cygpath "${SYSTEMROOT}/System32/curl.exe")"
139
+ elif [ -x "$(cygpath 'C:/msys64/usr/bin/curl.exe')" ]; then
140
+ TFLAGS+=" -ac $(cygpath 'C:/msys64/usr/bin/curl.exe')"
141
+ fi
142
+ TFLAGS+=' -j0'
143
+ if [ "${BUILD_SYSTEM}" = 'CMake' ]; then
144
+ cmake --build _bld --config "${PRJ_CFG}" --target test-ci
145
+ else
146
+ (
147
+ TFLAGS="-a -p !flaky -r -rm ${TFLAGS}"
148
+ cd _bld/tests
149
+ ./runtests.pl
150
+ )
151
+ fi
152
+ fi
153
+
154
+ # build examples
155
+
156
+ if [[ "${EXAMPLES}" = 'ON' ]] && \
157
+ [ "${BUILD_SYSTEM}" = 'CMake' ]; then
158
+ cmake --build _bld --config "${PRJ_CFG}" --parallel 2 --target curl-examples
159
+ fi
local-test-curl-delta-01/afc-curl/appveyor.yml ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
25
+ # https://ci.appveyor.com/project/curlorg/curl/history
26
+ # AppVeyor configuration:
27
+ # https://www.appveyor.com/docs/appveyor-yml/
28
+ # AppVeyor worker images:
29
+ # https://www.appveyor.com/docs/windows-images-software/
30
+
31
+ version: 7.50.0.{build}
32
+
33
+ environment:
34
+ UNITY: 'ON'
35
+ OPENSSL: 'OFF'
36
+ DEBUG: 'ON'
37
+ SHARED: 'OFF'
38
+ HTTP_ONLY: 'OFF'
39
+ TFLAGS: 'skiprun'
40
+ EXAMPLES: 'OFF'
41
+
42
+ matrix:
43
+
44
+ # generated CMake-based Visual Studio builds
45
+
46
+ - job_name: 'CMake, VS2008, Release, x86, Schannel, Shared, Build-tests'
47
+ APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015'
48
+ BUILD_SYSTEM: CMake
49
+ PRJ_GEN: 'Visual Studio 9 2008'
50
+ PRJ_CFG: Release
51
+ DEBUG: 'OFF'
52
+ SCHANNEL: 'ON'
53
+ ENABLE_UNICODE: 'OFF'
54
+ SHARED: 'ON'
55
+ - job_name: 'CMake, VS2008, Debug, x86, Schannel, Shared, Build-tests & examples'
56
+ APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015'
57
+ BUILD_SYSTEM: CMake
58
+ PRJ_GEN: 'Visual Studio 9 2008'
59
+ PRJ_CFG: Debug
60
+ SCHANNEL: 'ON'
61
+ ENABLE_UNICODE: 'OFF'
62
+ SHARED: 'ON'
63
+ EXAMPLES: 'ON'
64
+ - job_name: 'CMake, VS2022, Release, x64, OpenSSL 3.3, Shared, Build-tests'
65
+ APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022'
66
+ BUILD_SYSTEM: CMake
67
+ PRJ_GEN: 'Visual Studio 17 2022'
68
+ TARGET: '-A x64'
69
+ PRJ_CFG: Release
70
+ OPENSSL: 'ON'
71
+ SCHANNEL: 'OFF'
72
+ ENABLE_UNICODE: 'OFF'
73
+ SHARED: 'ON'
74
+ - job_name: 'CMake, VS2022, Release, arm64, Schannel, Static, Build-tests'
75
+ APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022'
76
+ BUILD_SYSTEM: CMake
77
+ PRJ_GEN: 'Visual Studio 17 2022'
78
+ TARGET: '-A ARM64'
79
+ PRJ_CFG: Release
80
+ SCHANNEL: 'ON'
81
+ ENABLE_UNICODE: 'OFF'
82
+ DEBUG: 'OFF'
83
+ CURLDEBUG: 'ON'
84
+ - job_name: 'CMake, VS2010, Debug, x64, Schannel, Static, Build-tests & examples'
85
+ APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015'
86
+ BUILD_SYSTEM: CMake
87
+ PRJ_GEN: 'Visual Studio 10 2010 Win64'
88
+ PRJ_CFG: Debug
89
+ SCHANNEL: 'ON'
90
+ ENABLE_UNICODE: 'OFF'
91
+ EXAMPLES: 'ON'
92
+ - job_name: 'CMake, VS2022, Debug, x64, Schannel, Static, Unicode, Build-tests & examples, clang-cl'
93
+ APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022'
94
+ BUILD_SYSTEM: CMake
95
+ PRJ_GEN: 'Visual Studio 17 2022'
96
+ TARGET: '-A x64'
97
+ PRJ_CFG: Debug
98
+ SCHANNEL: 'ON'
99
+ ENABLE_UNICODE: 'ON'
100
+ EXAMPLES: 'ON'
101
+ TOOLSET: 'ClangCl'
102
+ - job_name: 'CMake, VS2022, Debug, x64, Schannel, Static, Unicode, Build-tests'
103
+ APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022'
104
+ BUILD_SYSTEM: CMake
105
+ PRJ_GEN: 'Visual Studio 17 2022'
106
+ TARGET: '-A x64'
107
+ PRJ_CFG: Debug
108
+ SCHANNEL: 'ON'
109
+ ENABLE_UNICODE: 'ON'
110
+ - job_name: 'CMake, VS2022, Release, x64, Schannel, Shared, Unicode, DEBUGBUILD, no-CURLDEBUG, Build-tests'
111
+ APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022'
112
+ BUILD_SYSTEM: CMake
113
+ PRJ_GEN: 'Visual Studio 17 2022'
114
+ TARGET: '-A x64'
115
+ PRJ_CFG: Release
116
+ SCHANNEL: 'ON'
117
+ ENABLE_UNICODE: 'ON'
118
+ SHARED: 'ON'
119
+ CURLDEBUG: 'OFF'
120
+ - job_name: 'CMake, VS2022, Debug, x64, no SSL, Static, Build-tests'
121
+ APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022'
122
+ BUILD_SYSTEM: CMake
123
+ PRJ_GEN: 'Visual Studio 17 2022'
124
+ TARGET: '-A x64'
125
+ PRJ_CFG: Debug
126
+ SCHANNEL: 'OFF'
127
+ ENABLE_UNICODE: 'OFF'
128
+ - job_name: 'CMake, VS2022, Debug, x64, no SSL, Static, HTTP only, Build-tests'
129
+ APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022'
130
+ BUILD_SYSTEM: CMake
131
+ PRJ_GEN: 'Visual Studio 17 2022'
132
+ TARGET: '-A x64'
133
+ PRJ_CFG: Debug
134
+ SCHANNEL: 'OFF'
135
+ ENABLE_UNICODE: 'OFF'
136
+ HTTP_ONLY: 'ON'
137
+
138
+ # winbuild-based builds
139
+
140
+ - job_name: 'winbuild, VS2015, Debug, x64, OpenSSL 1.1.1, Build-only'
141
+ APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015'
142
+ BUILD_SYSTEM: winbuild_vs2015
143
+ DEBUG: 'yes'
144
+ PATHPART: debug
145
+ ENABLE_UNICODE: 'no'
146
+ - job_name: 'winbuild, VS2015, Release, x64, OpenSSL 1.1.1, Build-only'
147
+ APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015'
148
+ BUILD_SYSTEM: winbuild_vs2015
149
+ DEBUG: 'no'
150
+ PATHPART: release
151
+ ENABLE_UNICODE: 'no'
152
+ - job_name: 'winbuild, VS2017, Debug, x64, OpenSSL 1.1.1, Build-only'
153
+ APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2017'
154
+ BUILD_SYSTEM: winbuild_vs2017
155
+ DEBUG: 'yes'
156
+ PATHPART: debug
157
+ ENABLE_UNICODE: 'no'
158
+ - job_name: 'winbuild, VS2017, Release, x64, OpenSSL 1.1.1, Build-only'
159
+ APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2017'
160
+ BUILD_SYSTEM: winbuild_vs2017
161
+ DEBUG: 'no'
162
+ PATHPART: release
163
+ ENABLE_UNICODE: 'no'
164
+ - job_name: 'winbuild, VS2015, Debug, x64, OpenSSL 1.1.1, Unicode, Build-only'
165
+ APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015'
166
+ BUILD_SYSTEM: winbuild_vs2015
167
+ DEBUG: 'yes'
168
+ PATHPART: debug
169
+ ENABLE_UNICODE: 'yes'
170
+ - job_name: 'winbuild, VS2015, Release, x64, OpenSSL 1.1.1, Unicode, Build-only'
171
+ APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015'
172
+ BUILD_SYSTEM: winbuild_vs2015
173
+ DEBUG: 'no'
174
+ PATHPART: release
175
+ ENABLE_UNICODE: 'yes'
176
+ - job_name: 'winbuild, VS2017, Debug, x64, OpenSSL 1.1.1, Unicode, Build-only'
177
+ APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2017'
178
+ BUILD_SYSTEM: winbuild_vs2017
179
+ DEBUG: 'yes'
180
+ PATHPART: debug
181
+ ENABLE_UNICODE: 'yes'
182
+ - job_name: 'winbuild, VS2017, Release, x64, OpenSSL 1.1.1, Unicode, Build-only'
183
+ APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2017'
184
+ BUILD_SYSTEM: winbuild_vs2017
185
+ DEBUG: 'no'
186
+ PATHPART: release
187
+ ENABLE_UNICODE: 'yes'
188
+
189
+ # generated VisualStudioSolution-based builds
190
+
191
+ - job_name: 'VisualStudioSolution, VS2013, Debug, x86, Schannel, Build-only'
192
+ APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015'
193
+ BUILD_SYSTEM: VisualStudioSolution
194
+ PRJ_CFG: 'DLL Debug - DLL Windows SSPI - DLL WinIDN'
195
+ VC_VERSION: VC12
196
+
197
+ install:
198
+ - ps: $env:PATH = "C:/msys64/usr/bin;$env:PATH"
199
+
200
+ build_script:
201
+ - cmd: sh -c ./appveyor.sh
202
+
203
+ clone_depth: 10
204
+
205
+ # select branches to avoid testing feature branches twice (as branch and as pull request)
206
+ branches:
207
+ only:
208
+ - master
209
+ - /\/ci$/
210
+
211
+ skip_commits:
212
+ files:
213
+ - '.circleci/*'
214
+ - '.github/**/*'
215
+ - 'packages/**/*'
216
+ - 'plan9/**/*'
217
+
218
+ #artifacts:
219
+ # - path: '**/curl.exe'
220
+ # name: curl
221
+ # - path: '**/*curl*.dll'
222
+ # name: libcurl dll
local-test-curl-delta-01/afc-curl/buildconf ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ #
3
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
4
+ #
5
+ # SPDX-License-Identifier: curl
6
+
7
+ echo "*** Do not use buildconf. Instead, just use: autoreconf -fi" >&2
8
+ exec ${AUTORECONF:-autoreconf} -fi "${@}"
local-test-curl-delta-01/afc-curl/buildconf.bat ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+ rem ***************************************************************************
3
+ rem * _ _ ____ _
4
+ rem * Project ___| | | | _ \| |
5
+ rem * / __| | | | |_) | |
6
+ rem * | (__| |_| | _ <| |___
7
+ rem * \___|\___/|_| \_\_____|
8
+ rem *
9
+ rem * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
10
+ rem *
11
+ rem * This software is licensed as described in the file COPYING, which
12
+ rem * you should have received as part of this distribution. The terms
13
+ rem * are also available at https://curl.se/docs/copyright.html.
14
+ rem *
15
+ rem * You may opt to use, copy, modify, merge, publish, distribute and/or sell
16
+ rem * copies of the Software, and permit persons to whom the Software is
17
+ rem * furnished to do so, under the terms of the COPYING file.
18
+ rem *
19
+ rem * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20
+ rem * KIND, either express or implied.
21
+ rem *
22
+ rem * SPDX-License-Identifier: curl
23
+ rem *
24
+ rem ***************************************************************************
25
+
26
+ rem NOTES
27
+ rem
28
+ rem This batch file must be used to set up a git tree to build on systems where
29
+ rem there is no autotools support (i.e. DOS and Windows).
30
+ rem
31
+
32
+ :begin
33
+ rem Set our variables
34
+ if "%OS%" == "Windows_NT" setlocal
35
+ set MODE=GENERATE
36
+
37
+ rem Switch to this batch file's directory
38
+ cd /d "%~0\.." 1>NUL 2>&1
39
+
40
+ rem Check we are running from a curl git repository
41
+ if not exist GIT-INFO.md goto norepo
42
+
43
+ :parseArgs
44
+ if "%~1" == "" goto start
45
+
46
+ if /i "%~1" == "-clean" (
47
+ set MODE=CLEAN
48
+ ) else if /i "%~1" == "-?" (
49
+ goto syntax
50
+ ) else if /i "%~1" == "-h" (
51
+ goto syntax
52
+ ) else if /i "%~1" == "-help" (
53
+ goto syntax
54
+ ) else (
55
+ goto unknown
56
+ )
57
+
58
+ shift & goto parseArgs
59
+
60
+ :start
61
+ if "%MODE%" == "GENERATE" (
62
+ echo.
63
+ echo Generating prerequisite files
64
+
65
+ call :generate
66
+ if errorlevel 3 goto nogenhugehelp
67
+ if errorlevel 2 goto nogenmakefile
68
+ if errorlevel 1 goto warning
69
+
70
+ ) else (
71
+ echo.
72
+ echo Removing prerequisite files
73
+
74
+ call :clean
75
+ if errorlevel 2 goto nocleanhugehelp
76
+ if errorlevel 1 goto nocleanmakefile
77
+ )
78
+
79
+ goto success
80
+
81
+ rem Main generate function.
82
+ rem
83
+ rem Returns:
84
+ rem
85
+ rem 0 - success
86
+ rem 1 - success with simplified tool_hugehelp.c
87
+ rem 2 - failed to generate Makefile
88
+ rem 3 - failed to generate tool_hugehelp.c
89
+ rem
90
+ :generate
91
+ if "%OS%" == "Windows_NT" setlocal
92
+ set BASIC_HUGEHELP=0
93
+
94
+ rem Create Makefile
95
+ echo * %CD%\Makefile
96
+ if exist Makefile.dist (
97
+ copy /Y Makefile.dist Makefile 1>NUL 2>&1
98
+ if errorlevel 1 (
99
+ if "%OS%" == "Windows_NT" endlocal
100
+ exit /B 2
101
+ )
102
+ )
103
+
104
+ rem Create tool_hugehelp.c
105
+ echo * %CD%\src\tool_hugehelp.c
106
+ call :genHugeHelp
107
+ if errorlevel 2 (
108
+ if "%OS%" == "Windows_NT" endlocal
109
+ exit /B 3
110
+ )
111
+ if errorlevel 1 (
112
+ set BASIC_HUGEHELP=1
113
+ )
114
+ cmd /c exit 0
115
+
116
+ if "%BASIC_HUGEHELP%" == "1" (
117
+ if "%OS%" == "Windows_NT" endlocal
118
+ exit /B 1
119
+ )
120
+
121
+ if "%OS%" == "Windows_NT" endlocal
122
+ exit /B 0
123
+
124
+ rem Main clean function.
125
+ rem
126
+ rem Returns:
127
+ rem
128
+ rem 0 - success
129
+ rem 1 - failed to clean Makefile
130
+ rem 2 - failed to clean tool_hugehelp.c
131
+ rem
132
+ :clean
133
+ rem Remove Makefile
134
+ echo * %CD%\Makefile
135
+ if exist Makefile (
136
+ del Makefile 2>NUL
137
+ if exist Makefile (
138
+ exit /B 1
139
+ )
140
+ )
141
+
142
+ rem Remove tool_hugehelp.c
143
+ echo * %CD%\src\tool_hugehelp.c
144
+ if exist src\tool_hugehelp.c (
145
+ del src\tool_hugehelp.c 2>NUL
146
+ if exist src\tool_hugehelp.c (
147
+ exit /B 2
148
+ )
149
+ )
150
+
151
+ exit /B
152
+
153
+ rem Function to generate src\tool_hugehelp.c
154
+ rem
155
+ rem Returns:
156
+ rem
157
+ rem 0 - full tool_hugehelp.c generated
158
+ rem 1 - simplified tool_hugehelp.c
159
+ rem 2 - failure
160
+ rem
161
+ :genHugeHelp
162
+ if "%OS%" == "Windows_NT" setlocal
163
+ set LC_ALL=C
164
+ set BASIC=1
165
+
166
+ if exist src\tool_hugehelp.c.cvs (
167
+ copy /Y src\tool_hugehelp.c.cvs src\tool_hugehelp.c 1>NUL 2>&1
168
+ ) else (
169
+ echo #include "tool_setup.h"> src\tool_hugehelp.c
170
+ echo #include "tool_hugehelp.h">> src\tool_hugehelp.c
171
+ echo.>> src\tool_hugehelp.c
172
+ echo void hugehelp(void^)>> src\tool_hugehelp.c
173
+ echo {>> src\tool_hugehelp.c
174
+ echo #ifdef USE_MANUAL>> src\tool_hugehelp.c
175
+ echo fputs("Built-in manual not included\n", stdout^);>> src\tool_hugehelp.c
176
+ echo #endif>> src\tool_hugehelp.c
177
+ echo }>> src\tool_hugehelp.c
178
+ )
179
+
180
+ findstr "/C:void hugehelp(void)" src\tool_hugehelp.c 1>NUL 2>&1
181
+ if errorlevel 1 (
182
+ if "%OS%" == "Windows_NT" endlocal
183
+ exit /B 2
184
+ )
185
+
186
+ if "%BASIC%" == "1" (
187
+ if "%OS%" == "Windows_NT" endlocal
188
+ exit /B 1
189
+ )
190
+
191
+ if "%OS%" == "Windows_NT" endlocal
192
+ exit /B 0
193
+
194
+ rem Function to clean-up local variables under DOS, Windows 3.x and
195
+ rem Windows 9x as setlocal isn't available until Windows NT
196
+ rem
197
+ :dosCleanup
198
+ set MODE=
199
+ set BASIC_HUGEHELP=
200
+ set LC_ALL
201
+ set BASIC=
202
+
203
+ exit /B
204
+
205
+ :syntax
206
+ rem Display the help
207
+ echo.
208
+ echo Usage: buildconf [-clean]
209
+ echo.
210
+ echo -clean - Removes the files
211
+ goto error
212
+
213
+ :unknown
214
+ echo.
215
+ echo Error: Unknown argument '%1'
216
+ goto error
217
+
218
+ :norepo
219
+ echo.
220
+ echo Error: This batch file should only be used with a curl git repository
221
+ goto error
222
+
223
+ :nogenmakefile
224
+ echo.
225
+ echo Error: Unable to generate Makefile
226
+ goto error
227
+
228
+ :nogenhugehelp
229
+ echo.
230
+ echo Error: Unable to generate src\tool_hugehelp.c
231
+ goto error
232
+
233
+ :nocleanmakefile
234
+ echo.
235
+ echo Error: Unable to clean Makefile
236
+ goto error
237
+
238
+ :nocleanhugehelp
239
+ echo.
240
+ echo Error: Unable to clean src\tool_hugehelp.c
241
+ goto error
242
+
243
+ :warning
244
+ echo.
245
+ echo Warning: The curl manual could not be integrated in the source. This means when
246
+ echo you build curl the manual will not be available (curl --manual^). Integration of
247
+ echo the manual is not required and a summary of the options will still be available
248
+ echo (curl --help^). To integrate the manual build with configure or cmake.
249
+ goto success
250
+
251
+ :error
252
+ if "%OS%" == "Windows_NT" (
253
+ endlocal
254
+ ) else (
255
+ call :dosCleanup
256
+ )
257
+ exit /B 1
258
+
259
+ :success
260
+ if "%OS%" == "Windows_NT" (
261
+ endlocal
262
+ ) else (
263
+ call :dosCleanup
264
+ )
265
+ exit /B 0
local-test-curl-delta-01/afc-curl/configure.ac ADDED
The diff for this file is too large to render. See raw diff
 
local-test-curl-delta-01/afc-curl/curl-config.in ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ #***************************************************************************
3
+ # _ _ ____ _
4
+ # Project ___| | | | _ \| |
5
+ # / __| | | | |_) | |
6
+ # | (__| |_| | _ <| |___
7
+ # \___|\___/|_| \_\_____|
8
+ #
9
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
10
+ #
11
+ # This software is licensed as described in the file COPYING, which
12
+ # you should have received as part of this distribution. The terms
13
+ # are also available at https://curl.se/docs/copyright.html.
14
+ #
15
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
16
+ # copies of the Software, and permit persons to whom the Software is
17
+ # furnished to do so, under the terms of the COPYING file.
18
+ #
19
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20
+ # KIND, either express or implied.
21
+ #
22
+ # SPDX-License-Identifier: curl
23
+ #
24
+ ###########################################################################
25
+
26
+ # shellcheck disable=SC2006
27
+
28
+ prefix='@prefix@'
29
+ # Used in 'libdir'
30
+ # shellcheck disable=SC2034
31
+ exec_prefix="@exec_prefix@"
32
+ # shellcheck disable=SC2034
33
+ includedir="@includedir@"
34
+ cppflag_curl_staticlib='@LIBCURL_PC_CFLAGS@'
35
+
36
+ usage()
37
+ {
38
+ cat <<EOF
39
+ Usage: curl-config [OPTION]
40
+
41
+ Available values for OPTION include:
42
+
43
+ --built-shared says 'yes' if libcurl was built shared
44
+ --ca CA bundle install path
45
+ --cc compiler
46
+ --cflags preprocessor and compiler flags
47
+ --checkfor [version] check for (lib)curl of the specified version
48
+ --configure the arguments given to configure when building curl
49
+ --features newline separated list of enabled features
50
+ --help display this help and exit
51
+ --libs library linking information
52
+ --prefix curl install prefix
53
+ --protocols newline separated list of enabled protocols
54
+ --ssl-backends output the SSL backends libcurl was built to support
55
+ --static-libs static libcurl library linking information
56
+ --version output version information
57
+ --vernum output version as a hexadecimal number
58
+ EOF
59
+
60
+ exit "$1"
61
+ }
62
+
63
+ if test "$#" -eq 0; then
64
+ usage 1
65
+ fi
66
+
67
+ while test "$#" -gt 0; do
68
+ case "$1" in
69
+ --built-shared)
70
+ echo '@ENABLE_SHARED@'
71
+ ;;
72
+
73
+ --ca)
74
+ echo '@CURL_CA_BUNDLE@'
75
+ ;;
76
+
77
+ --cc)
78
+ echo '@CC@'
79
+ ;;
80
+
81
+ --prefix)
82
+ echo "$prefix"
83
+ ;;
84
+
85
+ --feature|--features)
86
+ for feature in @SUPPORT_FEATURES@ ''; do
87
+ test -n "$feature" && echo "$feature"
88
+ done
89
+ ;;
90
+
91
+ --protocols)
92
+ # shellcheck disable=SC2043
93
+ for protocol in @SUPPORT_PROTOCOLS@; do
94
+ echo "$protocol"
95
+ done
96
+ ;;
97
+
98
+ --version)
99
+ echo 'libcurl @CURLVERSION@'
100
+ exit 0
101
+ ;;
102
+
103
+ --checkfor)
104
+ checkfor="$2"
105
+ cmajor=`echo "$checkfor" | cut -d. -f1`
106
+ cminor=`echo "$checkfor" | cut -d. -f2`
107
+ # when extracting the patch part we strip off everything after a
108
+ # dash as that's used for things like version 1.2.3-pre1
109
+ cpatch=`echo "$checkfor" | cut -d. -f3 | cut -d- -f1`
110
+
111
+ vmajor=`echo '@CURLVERSION@' | cut -d. -f1`
112
+ vminor=`echo '@CURLVERSION@' | cut -d. -f2`
113
+ # when extracting the patch part we strip off everything after a
114
+ # dash as that's used for things like version 1.2.3-pre1
115
+ vpatch=`echo '@CURLVERSION@' | cut -d. -f3 | cut -d- -f1`
116
+
117
+ if test "$vmajor" -gt "$cmajor"; then
118
+ exit 0
119
+ fi
120
+ if test "$vmajor" -eq "$cmajor"; then
121
+ if test "$vminor" -gt "$cminor"; then
122
+ exit 0
123
+ fi
124
+ if test "$vminor" -eq "$cminor"; then
125
+ if test "$cpatch" -le "$vpatch"; then
126
+ exit 0
127
+ fi
128
+ fi
129
+ fi
130
+
131
+ echo "requested version $checkfor is newer than existing @CURLVERSION@"
132
+ exit 1
133
+ ;;
134
+
135
+ --vernum)
136
+ echo '@VERSIONNUM@'
137
+ exit 0
138
+ ;;
139
+
140
+ --help)
141
+ usage 0
142
+ ;;
143
+
144
+ --cflags)
145
+ if test "X$cppflag_curl_staticlib" = 'X-DCURL_STATICLIB'; then
146
+ CPPFLAG_CURL_STATICLIB='-DCURL_STATICLIB '
147
+ else
148
+ CPPFLAG_CURL_STATICLIB=''
149
+ fi
150
+ if test "X@includedir@" = 'X/usr/include'; then
151
+ echo "${CPPFLAG_CURL_STATICLIB}"
152
+ else
153
+ echo "${CPPFLAG_CURL_STATICLIB}-I@includedir@"
154
+ fi
155
+ ;;
156
+
157
+ --libs)
158
+ if test "X@libdir@" != 'X/usr/lib' -a "X@libdir@" != 'X/usr/lib64'; then
159
+ CURLLIBDIR="-L@libdir@ "
160
+ else
161
+ CURLLIBDIR=''
162
+ fi
163
+ if test 'X@ENABLE_SHARED@' = 'Xno'; then
164
+ echo "${CURLLIBDIR}-lcurl @LIBCURL_PC_LIBS_PRIVATE@"
165
+ else
166
+ echo "${CURLLIBDIR}-lcurl"
167
+ fi
168
+ ;;
169
+
170
+ --ssl-backends)
171
+ echo '@SSL_BACKENDS@'
172
+ ;;
173
+
174
+ --static-libs)
175
+ if test 'X@ENABLE_STATIC@' != 'Xno'; then
176
+ echo "@libdir@/libcurl.@libext@ @LIBCURL_PC_LDFLAGS_PRIVATE@ @LIBCURL_PC_LIBS_PRIVATE@"
177
+ else
178
+ echo 'curl was built with static libraries disabled' >&2
179
+ exit 1
180
+ fi
181
+ ;;
182
+
183
+ --configure)
184
+ echo @CONFIGURE_OPTIONS@
185
+ ;;
186
+
187
+ *)
188
+ echo "unknown option: $1"
189
+ usage 1
190
+ ;;
191
+ esac
192
+ shift
193
+ done
194
+
195
+ exit 0
local-test-curl-delta-01/afc-curl/libcurl.pc.in ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
25
+ prefix=@prefix@
26
+ exec_prefix=@exec_prefix@
27
+ libdir=@libdir@
28
+ includedir=@includedir@
29
+ supported_protocols="@SUPPORT_PROTOCOLS@"
30
+ supported_features="@SUPPORT_FEATURES@"
31
+
32
+ Name: libcurl
33
+ URL: https://curl.se/
34
+ Description: Library to transfer files with HTTP, FTP, etc.
35
+ Version: @CURLVERSION@
36
+ Requires: @LIBCURL_PC_REQUIRES@
37
+ Requires.private: @LIBCURL_PC_REQUIRES_PRIVATE@
38
+ Libs: -L${libdir} -lcurl @LIBCURL_PC_LIBS@
39
+ Libs.private: @LIBCURL_PC_LDFLAGS_PRIVATE@ @LIBCURL_PC_LIBS_PRIVATE@
40
+ Cflags: -I${includedir} @LIBCURL_PC_CFLAGS@
41
+ Cflags.private: @LIBCURL_PC_CFLAGS_PRIVATE@
local-test-curl-delta-01/diff/ref.diff ADDED
@@ -0,0 +1,785 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/.gitignore b/.gitignore
2
+ index 55768f6ed..afc0724aa 100644
3
+ --- a/.gitignore
4
+ +++ b/.gitignore
5
+ @@ -2,6 +2,7 @@
6
+ #
7
+ # SPDX-License-Identifier: curl
8
+
9
+ +curl-install/*
10
+ *.asc
11
+ *.dll
12
+ *.exe
13
+ diff --git a/include/curl/curl.h b/include/curl/curl.h
14
+ index 18835586a..e3af00ca2 100644
15
+ --- a/include/curl/curl.h
16
+ +++ b/include/curl/curl.h
17
+ @@ -1078,6 +1078,7 @@ typedef CURLSTScode (*curl_hstswrite_callback)(CURL *easy,
18
+ #define CURLPROTO_SMBS (1<<27)
19
+ #define CURLPROTO_MQTT (1<<28)
20
+ #define CURLPROTO_GOPHERS (1<<29)
21
+ +#define CURLPROTO_VERYNORMAL (1<<30)
22
+ #define CURLPROTO_ALL (~0) /* enable everything */
23
+
24
+ /* long may be 32 or 64 bits, but we should never depend on anything else
25
+ diff --git a/lib/Makefile.inc b/lib/Makefile.inc
26
+ index 1d3f69a23..70c313e7c 100644
27
+ --- a/lib/Makefile.inc
28
+ +++ b/lib/Makefile.inc
29
+ @@ -235,6 +235,7 @@ LIB_CFILES = \
30
+ urlapi.c \
31
+ version.c \
32
+ version_win32.c \
33
+ + verynormalprotocol.c \
34
+ warnless.c \
35
+ ws.c
36
+
37
+ diff --git a/lib/url.c b/lib/url.c
38
+ index 436edd891..cc5fd0184 100644
39
+ --- a/lib/url.c
40
+ +++ b/lib/url.c
41
+ @@ -119,6 +119,7 @@
42
+ #include "altsvc.h"
43
+ #include "dynbuf.h"
44
+ #include "headers.h"
45
+ +#include "verynormalprotocol.h"
46
+
47
+ /* The last 3 #include files should be in this order */
48
+ #include "curl_printf.h"
49
+ @@ -1600,6 +1601,8 @@ const struct Curl_handler *Curl_getn_scheme_handler(const char *scheme,
50
+ NULL,
51
+ #endif
52
+ };
53
+ + if(strcmp(scheme, "verynormalprotocol") == 0)
54
+ + return &Curl_handler_verynormalprotocol;
55
+
56
+ if(len && (len <= 7)) {
57
+ const char *s = scheme;
58
+ diff --git a/lib/urldata.h b/lib/urldata.h
59
+ index 704fb7a1d..3a02c1496 100644
60
+ --- a/lib/urldata.h
61
+ +++ b/lib/urldata.h
62
+ @@ -52,6 +52,7 @@
63
+ #define PORT_RTMPS PORT_HTTPS
64
+ #define PORT_GOPHER 70
65
+ #define PORT_MQTT 1883
66
+ +#define PORT_VERYNORMAL 6666
67
+
68
+ struct curl_trc_featt;
69
+
70
+ diff --git a/lib/verynormalprotocol.c b/lib/verynormalprotocol.c
71
+ new file mode 100644
72
+ index 000000000..6b53dc359
73
+ --- /dev/null
74
+ +++ b/lib/verynormalprotocol.c
75
+ @@ -0,0 +1,152 @@
76
+ +
77
+ +/***************************************************************************
78
+ + * _ _ ____ _
79
+ + * Project ___| | | | _ \| |
80
+ + * / __| | | | |_) | |
81
+ + * | (__| |_| | _ <| |___
82
+ + * \___|\___/|_| \_\_____|
83
+ + *
84
+ + * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
85
+ + *
86
+ + * This software is licensed as described in the file COPYING, which
87
+ + * you should have received as part of this distribution. The terms
88
+ + * are also available at https://curl.se/docs/copyright.html.
89
+ + *
90
+ + * You may opt to use, copy, modify, merge, publish, distribute and/or sell
91
+ + * copies of the Software, and permit persons to whom the Software is
92
+ + * furnished to do so, under the terms of the COPYING file.
93
+ + *
94
+ + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
95
+ + * KIND, either express or implied.
96
+ + *
97
+ + * SPDX-License-Identifier: curl
98
+ + *
99
+ + ***************************************************************************/
100
+ +
101
+ +/*
102
+ + * The "verynormalprotocol" is a basic protocol
103
+ + * intended to test Curls basic functionality.
104
+ + * Currently, it is very simple and only does one thing:
105
+ + * Checks to see if a server sends
106
+ + * "crashycrashy" immediately after connecting.
107
+ + * If it does, the transaction returns CURLE_OK.
108
+ + * Otherwise, it returns CURLE_WEIRD_SERVER_REPLY.
109
+ +*/
110
+ +#include "curl_setup.h"
111
+ +
112
+ +#ifdef HAVE_NETINET_IN_H
113
+ +#include <netinet/in.h>
114
+ +#endif
115
+ +#ifdef HAVE_NETDB_H
116
+ +#include <netdb.h>
117
+ +#endif
118
+ +#ifdef HAVE_ARPA_INET_H
119
+ +#include <arpa/inet.h>
120
+ +#endif
121
+ +#ifdef HAVE_NET_IF_H
122
+ +#include <net/if.h>
123
+ +#endif
124
+ +#ifdef HAVE_SYS_IOCTL_H
125
+ +#include <sys/ioctl.h>
126
+ +#endif
127
+ +
128
+ +#ifdef HAVE_SYS_PARAM_H
129
+ +#include <sys/param.h>
130
+ +#endif
131
+ +
132
+ +#ifdef HAVE_SYS_SELECT_H
133
+ +#include <sys/select.h>
134
+ +#elif defined(HAVE_UNISTD_H)
135
+ +#include <unistd.h>
136
+ +#endif
137
+ +
138
+ +#include "urldata.h"
139
+ +#include <curl/curl.h>
140
+ +#include "transfer.h"
141
+ +#include "sendf.h"
142
+ +#include "escape.h"
143
+ +#include "progress.h"
144
+ +#include "verynormalprotocol.h"
145
+ +#include "curl_printf.h"
146
+ +#include "strcase.h"
147
+ +#include "curl_memory.h"
148
+ +/* The last #include file should be: */
149
+ +#include "memdebug.h"
150
+ +#include "curl_md5.h"
151
+ +
152
+ +/*
153
+ + * Forward declarations.
154
+ + */
155
+ +
156
+ +static CURLcode verynormalprotocol_do(struct Curl_easy *data, bool *done);
157
+ +static CURLcode verynormalprotocol_doing(struct Curl_easy *data, bool *done);
158
+ +
159
+ +/*
160
+ + * verynormalprotocol protocol handler.
161
+ + */
162
+ +
163
+ +const struct Curl_handler Curl_handler_verynormalprotocol = {
164
+ + "verynormalprotocol", /* scheme */
165
+ + ZERO_NULL, /* setup_connection */
166
+ + verynormalprotocol_do, /* do_it */
167
+ + ZERO_NULL, /* done */
168
+ + ZERO_NULL, /* do_more */
169
+ + ZERO_NULL, /* connect_it */
170
+ + ZERO_NULL, /* connecting */
171
+ + verynormalprotocol_doing, /* doing */
172
+ + ZERO_NULL, /* proto_getsock */
173
+ + ZERO_NULL, /* doing_getsock */
174
+ + ZERO_NULL, /* domore_getsock */
175
+ + ZERO_NULL, /* perform_getsock */
176
+ + ZERO_NULL, /* disconnect */
177
+ + ZERO_NULL, /* write_resp */
178
+ + ZERO_NULL, /* write_resp_hd */
179
+ + ZERO_NULL, /* connection_check */
180
+ + ZERO_NULL, /* attach connection */
181
+ + PORT_VERYNORMAL, /* defport */
182
+ + CURLPROTO_VERYNORMAL, /* protocol */
183
+ + CURLPROTO_VERYNORMAL, /* family */
184
+ + PROTOPT_NONE /* flags */
185
+ +};
186
+ +
187
+ +static CURLcode verynormalprotocol_do(struct Curl_easy *data, bool *done)
188
+ +{
189
+ + *done = FALSE; /* unconditionally */
190
+ +
191
+ + return CURLE_OK;
192
+ +}
193
+ +
194
+ +static CURLcode verynormalprotocol_doing(struct Curl_easy *data, bool *done)
195
+ +{
196
+ + CURLcode result = CURLE_WEIRD_SERVER_REPLY;
197
+ + ssize_t nread;
198
+ + char response[128];
199
+ +
200
+ + *done = FALSE;
201
+ +
202
+ + /* Read the response from the server. If we see the correct "heartbeat",
203
+ + we should complete the transaction and return CURLE_OK. */
204
+ + do {
205
+ + result = Curl_xfer_recv(data, response, 128, &nread);
206
+ + } while(result == CURLE_AGAIN);
207
+ + if(result)
208
+ + return result;
209
+ + else if(!nread) {
210
+ + failf(data, "Connection disconnected");
211
+ + *done = TRUE;
212
+ + result = CURLE_RECV_ERROR;
213
+ + }
214
+ + else if(strcasecmp(response, "crashycrashy") == 0) {
215
+ + *done = TRUE;
216
+ + *(unsigned int *)result = CURLE_OK;
217
+ + }
218
+ + else {
219
+ + *done = TRUE;
220
+ + result = CURLE_WEIRD_SERVER_REPLY;
221
+ + }
222
+ +
223
+ + if(result == CURLE_AGAIN)
224
+ + result = CURLE_OK;
225
+ + return result;
226
+ +}
227
+ +
228
+ diff --git a/lib/verynormalprotocol.h b/lib/verynormalprotocol.h
229
+ new file mode 100644
230
+ index 000000000..cc48592bc
231
+ --- /dev/null
232
+ +++ b/lib/verynormalprotocol.h
233
+ @@ -0,0 +1,39 @@
234
+ +
235
+ +#ifndef HEADER_CURL_VERYNORMALPROTOCOL_H
236
+ +#define HEADER_CURL_VERYNORMALPROTOCOL_H
237
+ +/***************************************************************************
238
+ + * _ _ ____ _
239
+ + * Project ___| | | | _ \| |
240
+ + * / __| | | | |_) | |
241
+ + * | (__| |_| | _ <| |___
242
+ + * \___|\___/|_| \_\_____|
243
+ + *
244
+ + * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
245
+ + *
246
+ + * This software is licensed as described in the file COPYING, which
247
+ + * you should have received as part of this distribution. The terms
248
+ + * are also available at https://curl.se/docs/copyright.html.
249
+ + *
250
+ + * You may opt to use, copy, modify, merge, publish, distribute and/or sell
251
+ + * copies of the Software, and permit persons to whom the Software is
252
+ + * furnished to do so, under the terms of the COPYING file.
253
+ + *
254
+ + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
255
+ + * KIND, either express or implied.
256
+ + *
257
+ + * SPDX-License-Identifier: curl
258
+ + *
259
+ + ***************************************************************************/
260
+ +
261
+ +#ifndef CURL_DISABLE_VERYNORMALPROTOCOL
262
+ +extern const struct Curl_handler Curl_handler_verynormalprotocol;
263
+ +enum verynormalprotocolstate {
264
+ + VERYNORMALPROTOCOL_START,
265
+ + VERYNORMALPROTOCOL_DO
266
+ +};
267
+ +struct verynormalprotocol_conn {
268
+ + enum verynormalprotocolstate state;
269
+ +};
270
+ +#endif
271
+ +
272
+ +#endif /* HEADER_CURL_VERYNORMALPROTOCOL_H */
273
+ diff --git a/src/tool_help.c b/src/tool_help.c
274
+ index 57b14a3b0..e803b7eda 100644
275
+ --- a/src/tool_help.c
276
+ +++ b/src/tool_help.c
277
+ @@ -360,6 +360,7 @@ void tool_version_info(void)
278
+ }
279
+ #endif /* !CURL_DISABLE_IPFS */
280
+ }
281
+ + puts(" verynormalprotocol");
282
+ puts(""); /* newline */
283
+ }
284
+ if(feature_names[0]) {
285
+ diff --git a/src/tool_libinfo.c b/src/tool_libinfo.c
286
+ index f6053e840..46568eb9f 100644
287
+ --- a/src/tool_libinfo.c
288
+ +++ b/src/tool_libinfo.c
289
+ @@ -41,6 +41,7 @@ const char * const *built_in_protos = &no_protos;
290
+ size_t proto_count = 0;
291
+
292
+ const char *proto_file = NULL;
293
+ +const char *proto_verynormal = NULL;
294
+ const char *proto_ftp = NULL;
295
+ const char *proto_ftps = NULL;
296
+ const char *proto_http = NULL;
297
+ @@ -59,6 +60,7 @@ static struct proto_name_tokenp {
298
+ const char **proto_tokenp;
299
+ } const possibly_built_in[] = {
300
+ { "file", &proto_file },
301
+ + { "verynormalprotocol", &proto_verynormal },
302
+ { "ftp", &proto_ftp },
303
+ { "ftps", &proto_ftps },
304
+ { "http", &proto_http },
305
+ diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
306
+ index 776b5934b..42d564a07 100644
307
+ --- a/tests/data/Makefile.am
308
+ +++ b/tests/data/Makefile.am
309
+ @@ -135,7 +135,7 @@ test979 test980 test981 test982 test983 test984 test985 test986 test987 \
310
+ test988 test989 test990 test991 test992 test993 test994 test995 test996 \
311
+ test997 test998 test999 test1000 test1001 test1002 test1003 test1004 \
312
+ test1005 test1006 test1007 test1008 test1009 test1010 test1011 test1012 \
313
+ -test1013 test1014 test1015 test1016 test1017 test1018 test1019 test1020 \
314
+ +test1014 test1015 test1016 test1017 test1018 test1019 test1020 \
315
+ test1021 test1022 test1023 test1024 test1025 test1026 test1027 test1028 \
316
+ test1029 test1030 test1031 test1032 test1033 test1034 test1035 test1036 \
317
+ test1037 test1038 test1039 test1040 test1041 test1042 test1043 test1044 \
318
+ @@ -148,13 +148,13 @@ test1085 test1086 test1087 test1088 test1089 test1090 test1091 test1092 \
319
+ test1093 test1094 test1095 test1096 test1097 test1098 test1099 test1100 \
320
+ test1101 test1102 test1103 test1104 test1105 test1106 test1107 test1108 \
321
+ test1109 test1110 test1111 test1112 test1113 test1114 test1115 test1116 \
322
+ -test1117 test1118 test1119 test1120 test1121 test1122 test1123 test1124 \
323
+ +test1117 test1118 test1120 test1121 test1122 test1123 test1124 \
324
+ test1125 test1126 test1127 test1128 test1129 test1130 test1131 test1132 \
325
+ test1133 test1134 test1135 test1136 test1137 test1138 test1139 test1140 \
326
+ test1141 test1142 test1143 test1144 test1145 test1146 test1147 test1148 \
327
+ test1149 test1150 test1151 test1152 test1153 test1154 test1155 test1156 \
328
+ test1157 test1158 test1159 test1160 test1161 test1162 test1163 test1164 \
329
+ -test1165 test1166 test1167 test1168 test1169 test1170 test1171 test1172 \
330
+ +test1166 test1167 test1168 test1169 test1170 test1171 test1172 \
331
+ test1173 test1174 test1175 test1176 test1177 test1178 test1179 test1180 \
332
+ test1181 test1182 test1183 test1184 test1185 test1186 test1187 test1188 \
333
+ test1189 test1190 test1190 test1191 test1192 test1193 test1194 test1195 \
334
+ @@ -268,7 +268,7 @@ test3008 test3009 test3010 test3011 test3012 test3013 test3014 test3015 \
335
+ test3016 test3017 test3018 test3019 test3020 test3021 test3022 test3023 \
336
+ test3024 test3025 test3026 test3027 test3028 test3029 test3030 test3031 \
337
+ \
338
+ -test3100 test3101 test3102 test3103 \
339
+ +test3100 test3101 test3102 test3103 test11442 \
340
+ test3200 \
341
+ test3201 test3202 test3203 test3204 test3205 test3207
342
+
343
+ diff --git a/tests/data/test1013 b/tests/data/test1013
344
+ deleted file mode 100644
345
+ index 87e99cd56..000000000
346
+ --- a/tests/data/test1013
347
+ +++ /dev/null
348
+ @@ -1,37 +0,0 @@
349
+ -<testcase>
350
+ -<info>
351
+ -<keywords>
352
+ -curl-config
353
+ -</keywords>
354
+ -</info>
355
+ -
356
+ -#
357
+ -# Server-side
358
+ -<reply>
359
+ -</reply>
360
+ -
361
+ -#
362
+ -# Client-side
363
+ -<client>
364
+ -<server>
365
+ -none
366
+ -</server>
367
+ -<name>
368
+ -Compare curl --version with curl-config --protocols
369
+ -</name>
370
+ -<command>
371
+ ---version
372
+ -</command>
373
+ -</client>
374
+ -
375
+ -#
376
+ -# Verify data after the test has been "shot"
377
+ -<verify>
378
+ -<postcheck>
379
+ -%SRCDIR/libtest/test%TESTNUMBER.pl ../curl-config %LOGDIR/stdout%TESTNUMBER protocols
380
+ -</postcheck>
381
+ -<errorcode>
382
+ -0
383
+ -</errorcode>
384
+ -</verify>
385
+ -</testcase>
386
+ diff --git a/tests/data/test1119 b/tests/data/test1119
387
+ deleted file mode 100644
388
+ index 1a73439e6..000000000
389
+ --- a/tests/data/test1119
390
+ +++ /dev/null
391
+ @@ -1,30 +0,0 @@
392
+ -<testcase>
393
+ -<info>
394
+ -<keywords>
395
+ -source analysis
396
+ -symbols-in-versions
397
+ -</keywords>
398
+ -</info>
399
+ -
400
+ -#
401
+ -# Client-side
402
+ -<client>
403
+ -<server>
404
+ -none
405
+ -</server>
406
+ -
407
+ -<name>
408
+ -Verify that symbols-in-versions and headers are in sync
409
+ -</name>
410
+ -
411
+ -<command type="perl">
412
+ -%SRCDIR/test1119.pl %SRCDIR/.. ../include/curl
413
+ -</command>
414
+ -</client>
415
+ -
416
+ -<verify>
417
+ -<stdout>
418
+ -OK
419
+ -</stdout>
420
+ -</verify>
421
+ -</testcase>
422
+ diff --git a/tests/data/test11442 b/tests/data/test11442
423
+ new file mode 100644
424
+ index 000000000..d9b8ad0dc
425
+ --- /dev/null
426
+ +++ b/tests/data/test11442
427
+ @@ -0,0 +1,32 @@
428
+ +<testcase>
429
+ +<info>
430
+ +<keywords>
431
+ +verynormalprotocol
432
+ +</keywords>
433
+ +</info>
434
+ +# Server-side
435
+ +<reply>
436
+ +1
437
+ +</reply>
438
+ +
439
+ +# Client-side
440
+ +<client>
441
+ +<server>
442
+ +verynormalprotocol
443
+ +</server>
444
+ +
445
+ +<name>
446
+ +verynormalprotocol test 1
447
+ +</name>
448
+ +<command>
449
+ +verynormalprotocol://%HOSTIP:%VERYNORMALPROTOCOLPORT/asdf
450
+ +</command>
451
+ +</client>
452
+ +
453
+ +# Verify data
454
+ +<verify>
455
+ +<errorcode>
456
+ +8
457
+ +</errorcode>
458
+ +</verify>
459
+ +</testcase>
460
+ diff --git a/tests/data/test1165 b/tests/data/test1165
461
+ deleted file mode 100644
462
+ index 89f02d719..000000000
463
+ --- a/tests/data/test1165
464
+ +++ /dev/null
465
+ @@ -1,25 +0,0 @@
466
+ -<testcase>
467
+ -<info>
468
+ -<keywords>
469
+ -source analysis
470
+ -CURL_DISABLE
471
+ -</keywords>
472
+ -</info>
473
+ -
474
+ -#
475
+ -# Client-side
476
+ -<client>
477
+ -<server>
478
+ -none
479
+ -</server>
480
+ -
481
+ -<name>
482
+ -Verify configure.ac and source code CURL_DISABLE_-sync
483
+ -</name>
484
+ -
485
+ -<command type="perl">
486
+ -%SRCDIR/test1165.pl %SRCDIR/..
487
+ -</command>
488
+ -</client>
489
+ -
490
+ -</testcase>
491
+ diff --git a/tests/serverhelp.pm b/tests/serverhelp.pm
492
+ index 22cf30e52..dacdb0a03 100644
493
+ --- a/tests/serverhelp.pm
494
+ +++ b/tests/serverhelp.pm
495
+ @@ -133,7 +133,7 @@ sub servername_str {
496
+
497
+ $proto = uc($proto) if($proto);
498
+ die "unsupported protocol: '$proto'" unless($proto &&
499
+ - ($proto =~ /^(((FTP|HTTP|HTTP\/2|HTTP\/3|IMAP|POP3|GOPHER|SMTP|HTTP-PIPE)S?)|(TFTP|SFTP|SOCKS|SSH|RTSP|HTTPTLS|DICT|SMB|SMBS|TELNET|MQTT))$/));
500
+ + ($proto =~ /^(((FTP|HTTP|HTTP\/2|HTTP\/3|IMAP|POP3|GOPHER|SMTP|HTTP-PIPE)S?)|(TFTP|SFTP|SOCKS|SSH|RTSP|HTTPTLS|DICT|SMB|SMBS|TELNET|MQTT|VERYNORMALPROTOCOL))$/));
501
+
502
+ $ipver = (not $ipver) ? 'ipv4' : lc($ipver);
503
+ die "unsupported IP version: '$ipver'" unless($ipver &&
504
+ diff --git a/tests/servers.pm b/tests/servers.pm
505
+ index 37519eeb6..c84efef69 100644
506
+ --- a/tests/servers.pm
507
+ +++ b/tests/servers.pm
508
+ @@ -236,7 +236,7 @@ sub init_serverpidfile_hash {
509
+ }
510
+ }
511
+ for my $proto (('tftp', 'sftp', 'socks', 'ssh', 'rtsp', 'httptls',
512
+ - 'dict', 'smb', 'smbs', 'telnet', 'mqtt')) {
513
+ + 'dict', 'smb', 'smbs', 'telnet', 'mqtt', 'verynormalprotocol')) {
514
+ for my $ipvnum ((4, 6)) {
515
+ for my $idnum ((1, 2)) {
516
+ my $serv = servername_id($proto, $ipvnum, $idnum);
517
+ @@ -2052,6 +2052,67 @@ sub runsocksserver {
518
+ return (0, $pid2, $sockspid, $port);
519
+ }
520
+
521
+ +#######################################################################
522
+ +# start the verynormalprotocol server
523
+ +#
524
+ +sub runverynormalprotocolserver {
525
+ + my ($verb, $alt) = @_;
526
+ + my $proto = "verynormalprotocol";
527
+ + my $ip = $HOSTIP;
528
+ + my $ipvnum = 4;
529
+ + my $idnum = 1;
530
+ +
531
+ + if($alt eq "ipv6") {
532
+ + # No IPv6
533
+ + }
534
+ +
535
+ + my $server = servername_id($proto, $ipvnum, $idnum);
536
+ +
537
+ + my $pidfile = $serverpidfile{$server};
538
+ +
539
+ + # don't retry if the server doesn't work
540
+ + if ($doesntrun{$pidfile}) {
541
+ + return (2, 0, 0, 0);
542
+ + }
543
+ +
544
+ + my $pid = processexists($pidfile);
545
+ + if($pid > 0) {
546
+ + stopserver($server, "$pid");
547
+ + }
548
+ + unlink($pidfile) if(-f $pidfile);
549
+ +
550
+ + my $srvrname = servername_str($proto, $ipvnum, $idnum);
551
+ + my $logfile = server_logfilename($LOGDIR, $proto, $ipvnum, $idnum);
552
+ +
553
+ + my $flags = "";
554
+ + $flags .= "--verbose 1 " if($debugprotocol);
555
+ + $flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" ";
556
+ + $flags .= "--id $idnum " if($idnum > 1);
557
+ + $flags .= "--srcdir \"$srcdir\" ";
558
+ + $flags .= "--host $HOSTIP";
559
+ +
560
+ + my $port = getfreeport($ipvnum);
561
+ + my $aflags = "--port $port $flags";
562
+ + my $cmd = "$srcdir/verynormalprotocolserver.py $aflags";
563
+ + my ($dictpid, $pid2) = startnew($cmd, $pidfile, 15, 0);
564
+ +
565
+ + if($dictpid <= 0 || !pidexists($dictpid)) {
566
+ + # it is NOT alive
567
+ + stopserver($server, "$pid2");
568
+ + $doesntrun{$pidfile} = 1;
569
+ + $dictpid = $pid2 = 0;
570
+ + logmsg "RUN: failed to start the $srvrname server\n";
571
+ + return (3, 0, 0, 0);
572
+ + }
573
+ + $doesntrun{$pidfile} = 0;
574
+ +
575
+ + if($verb) {
576
+ + logmsg "RUN: $srvrname server PID $dictpid port $port\n";
577
+ + }
578
+ +
579
+ + return (0+!$dictpid, $dictpid, $pid2, $port);
580
+ +}
581
+ +
582
+ #######################################################################
583
+ # start the dict server
584
+ #
585
+ @@ -2946,6 +3007,17 @@ sub startservers {
586
+ $run{'http-unix'}="$pid $pid2";
587
+ }
588
+ }
589
+ + elsif($what eq "verynormalprotocol") {
590
+ + if(!$run{'verynormalprotocol'}) {
591
+ + ($serr, $pid, $pid2, $PORT{"verynormalprotocol"}) = runverynormalprotocolserver($verbose, "");
592
+ + if($pid <= 0) {
593
+ + return ("failed starting verynormalprotocol server", $serr);
594
+ + }
595
+ + logmsg sprintf ("* pid VERYNORMAL => %d %d\n", $pid, $pid2)
596
+ + if($verbose);
597
+ + $run{'verynormalprotocol'}="$pid $pid2";
598
+ + }
599
+ + }
600
+ elsif($what eq "dict") {
601
+ if(!$run{'dict'}) {
602
+ ($serr, $pid, $pid2, $PORT{"dict"}) = rundictserver($verbose, "");
603
+ @@ -3079,7 +3151,7 @@ sub subvariables {
604
+ 'SOCKS',
605
+ 'SSH',
606
+ 'TELNET',
607
+ - 'TFTP', 'TFTP6') {
608
+ + 'TFTP', 'TFTP6', 'VERYNORMALPROTOCOL') {
609
+ $port = protoport(lc $proto);
610
+ $$thing =~ s/${prefix}(?:$proto)PORT/$port/g;
611
+ }
612
+ diff --git a/tests/verynormalprotocolserver.py b/tests/verynormalprotocolserver.py
613
+ new file mode 100755
614
+ index 000000000..82302cc48
615
+ --- /dev/null
616
+ +++ b/tests/verynormalprotocolserver.py
617
+ @@ -0,0 +1,168 @@
618
+ +#!/usr/bin/env python3
619
+ +# -*- coding: utf-8 -*-
620
+ +#***************************************************************************
621
+ +# _ _ ____ _
622
+ +# Project ___| | | | _ \| |
623
+ +# / __| | | | |_) | |
624
+ +# | (__| |_| | _ <| |___
625
+ +# \___|\___/|_| \_\_____|
626
+ +#
627
+ +# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
628
+ +#
629
+ +# This software is licensed as described in the file COPYING, which
630
+ +# you should have received as part of this distribution. The terms
631
+ +# are also available at https://curl.se/docs/copyright.html.
632
+ +#
633
+ +# You may opt to use, copy, modify, merge, publish, distribute and/or sell
634
+ +# copies of the Software, and permit persons to whom the Software is
635
+ +# furnished to do so, under the terms of the COPYING file.
636
+ +#
637
+ +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
638
+ +# KIND, either express or implied.
639
+ +#
640
+ +# SPDX-License-Identifier: curl
641
+ +#
642
+ +###########################################################################
643
+ +#
644
+ +"""verynormalprotocol server."""
645
+ +
646
+ +from __future__ import (absolute_import, division, print_function,
647
+ + unicode_literals)
648
+ +
649
+ +import argparse
650
+ +import logging
651
+ +import os
652
+ +import sys
653
+ +
654
+ +from util import ClosingFileHandler
655
+ +
656
+ +try: # Python 2
657
+ + import SocketServer as socketserver # type: ignore
658
+ +except ImportError: # Python 3
659
+ + import socketserver
660
+ +
661
+ +log = logging.getLogger(__name__)
662
+ +HOST = "localhost"
663
+ +
664
+ +# The strings that indicate the test framework is checking our aliveness
665
+ +VERIFIED_REQ = b"verifiedserver"
666
+ +VERIFIED_RSP = "WE ROOLZ: {pid}"
667
+ +
668
+ +
669
+ +def verynormalprotocolserver(options):
670
+ + """Start up a TCP server with a verynormalprotocol handler and serve very normal requests forever."""
671
+ + if options.pidfile:
672
+ + pid = os.getpid()
673
+ + # see tests/server/util.c function write_pidfile
674
+ + if os.name == "nt":
675
+ + pid += 65536
676
+ + with open(options.pidfile, "w") as f:
677
+ + f.write(str(pid))
678
+ +
679
+ + local_bind = (options.host, options.port)
680
+ + log.info("[verynormalprotocol] Listening on %s", local_bind)
681
+ +
682
+ + # Need to set the allow_reuse on the class, not on the instance.
683
+ + socketserver.TCPServer.allow_reuse_address = True
684
+ + server = socketserver.TCPServer(local_bind, verynormalprotocolHandler)
685
+ + server.serve_forever()
686
+ +
687
+ + return ScriptRC.SUCCESS
688
+ +
689
+ +
690
+ +class verynormalprotocolHandler(socketserver.BaseRequestHandler):
691
+ + """Handler class for verynormalprotocol connections."""
692
+ +
693
+ + def handle(self):
694
+ + try:
695
+ + print('got connection')
696
+ + # First, send a response to allow the server to continue.
697
+ + rsp = "220 verynormalprotocolserver <xnooptions> <msgid@msgid>\n"
698
+ + self.request.sendall(rsp.encode("utf-8"))
699
+ + # Receive the request.
700
+ + data = self.request.recv(1024).strip()
701
+ + log.debug("[DICT] Incoming data: %r", data)
702
+ +
703
+ + except IOError:
704
+ + log.exception("[verynormalprotocol] IOError hit during request")
705
+ +
706
+ +
707
+ +def get_options():
708
+ + parser = argparse.ArgumentParser()
709
+ +
710
+ + parser.add_argument("--port", action="store", default=9016,
711
+ + type=int, help="port to listen on")
712
+ + parser.add_argument("--host", action="store", default=HOST,
713
+ + help="host to listen on")
714
+ + parser.add_argument("--verbose", action="store", type=int, default=0,
715
+ + help="verbose output")
716
+ + parser.add_argument("--pidfile", action="store",
717
+ + help="file name for the PID")
718
+ + parser.add_argument("--logfile", action="store",
719
+ + help="file name for the log")
720
+ + parser.add_argument("--srcdir", action="store", help="test directory")
721
+ + parser.add_argument("--id", action="store", help="server ID")
722
+ + parser.add_argument("--ipv4", action="store_true", default=0,
723
+ + help="IPv4 flag")
724
+ +
725
+ + return parser.parse_args()
726
+ +
727
+ +
728
+ +def setup_logging(options):
729
+ + """Set up logging from the command line options."""
730
+ + root_logger = logging.getLogger()
731
+ + add_stdout = False
732
+ +
733
+ + formatter = logging.Formatter("%(asctime)s %(levelname)-5.5s %(message)s")
734
+ +
735
+ + # Write out to a logfile
736
+ + if options.logfile:
737
+ + handler = ClosingFileHandler(options.logfile)
738
+ + handler.setFormatter(formatter)
739
+ + handler.setLevel(logging.DEBUG)
740
+ + root_logger.addHandler(handler)
741
+ + else:
742
+ + # The logfile wasn't specified. Add a stdout logger.
743
+ + add_stdout = True
744
+ +
745
+ + if options.verbose:
746
+ + # Add a stdout logger as well in verbose mode
747
+ + root_logger.setLevel(logging.DEBUG)
748
+ + add_stdout = True
749
+ + else:
750
+ + root_logger.setLevel(logging.INFO)
751
+ +
752
+ + if add_stdout:
753
+ + stdout_handler = logging.StreamHandler(sys.stdout)
754
+ + stdout_handler.setFormatter(formatter)
755
+ + stdout_handler.setLevel(logging.DEBUG)
756
+ + root_logger.addHandler(stdout_handler)
757
+ +
758
+ +
759
+ +class ScriptRC(object):
760
+ + """Enum for script return codes."""
761
+ +
762
+ + SUCCESS = 0
763
+ + FAILURE = 1
764
+ + EXCEPTION = 2
765
+ +
766
+ +
767
+ +if __name__ == '__main__':
768
+ + # Get the options from the user.
769
+ + options = get_options()
770
+ +
771
+ + # Setup logging using the user options
772
+ + setup_logging(options)
773
+ +
774
+ + # Run main script.
775
+ + try:
776
+ + rc = verynormalprotocolserver(options)
777
+ + except Exception:
778
+ + log.exception('Error running server')
779
+ + rc = ScriptRC.EXCEPTION
780
+ +
781
+ + if options.pidfile and os.path.isfile(options.pidfile):
782
+ + os.unlink(options.pidfile)
783
+ +
784
+ + log.info("[verynormalprotocol] Returning %d", rc)
785
+ + sys.exit(rc)
local-test-curl-delta-01/fuzz-tooling/CITATION.cff ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cff-version: 1.2.0
2
+ title: OSS-Fuzz
3
+ message: >-
4
+ If you use this software, please cite it using the
5
+ metadata from this file.
6
+ type: software
7
+ authors:
8
+ - given-names: Abhishek
9
+ family-names: Arya
10
+ affiliation: Google LLC
11
+ email: aarya@google.com
12
+ orcid: 'https://orcid.org/0009-0009-4558-4314'
13
+ - given-names: Oliver
14
+ family-names: Chang
15
+ email: ochang@google.com
16
+ affiliation: Google LLC
17
+ orcid: 'https://orcid.org/0009-0006-3181-4551'
18
+ - given-names: Jonathan
19
+ family-names: Metzman
20
+ email: metzman@google.com
21
+ affiliation: Google LLC
22
+ orcid: 'https://orcid.org/0000-0002-7042-0444'
23
+ - given-names: Kostya
24
+ family-names: Serebryany
25
+ email: kcc@google.com
26
+ affiliation: Google LLC
27
+ orcid: 'https://orcid.org/0009-0009-2379-3641'
28
+ - given-names: Dongge
29
+ family-names: Liu
30
+ email: donggeliu@google.com
31
+ affiliation: Google LLC
32
+ orcid: 'https://orcid.org/0000-0003-4821-7033'
33
+ repository-code: 'https://github.com/google/oss-fuzz'
34
+ abstract: >-
35
+ OSS-Fuzz is an open-source project by Google that provides
36
+ continuous fuzzing for open-source software. It aims to
37
+ make common open-source software more secure and stable by
38
+ combining modern fuzzing techniques with scalable,
39
+ distributed execution. As of August 2023, OSS-Fuzz has
40
+ helped identify and fix over 10,000 vulnerabilities and
41
+ 36,000 bugs across 1,000 projects.
42
+ keywords:
43
+ - open-source
44
+ - fuzzing
45
+ license: Apache-2.0
46
+
local-test-curl-delta-01/fuzz-tooling/CONTRIBUTING.md ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Want to contribute? Great! First, read this page (including the small print at
2
+ the end).
3
+
4
+ ### Before you contribute
5
+ Before we can use your code, you must sign the
6
+ [Google Individual Contributor License Agreement](https://cla.developers.google.com/about/google-individual)
7
+ (CLA), which you can do online. The CLA is necessary mainly because you own the
8
+ copyright to your changes, even after your contribution becomes part of our
9
+ codebase, so we need your permission to use and distribute your code. We also
10
+ need to be sure of various other things: for instance that you'll tell us if you
11
+ know that your code infringes on other people's patents. You don't have to sign
12
+ the CLA until after you've submitted your code for review and a member has
13
+ approved it, but you must do it before we can put your code into our codebase.
14
+ Before you start working on a larger contribution, you should get in touch with
15
+ us first through the issue tracker with your idea so that we can help out and
16
+ possibly guide you. Coordinating up front makes it much easier to avoid
17
+ frustration later on.
18
+
19
+ ### Code reviews
20
+ All submissions, including submissions by project members, require review. We
21
+ use GitHub pull requests for this purpose.
22
+
23
+ ### The small print
24
+ Contributions made by corporations are covered by a different agreement than
25
+ the one above, the
26
+ [Software Grant and Corporate Contributor License Agreement](https://cla.developers.google.com/about/google-corporate).
local-test-curl-delta-01/fuzz-tooling/LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright {yyyy} {name of copyright owner}
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
local-test-curl-delta-01/fuzz-tooling/README.md ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # OSS-Fuzz-AIxCC: AIxCC AFC Competition fork of OSS-Fuzz (v1.2.0)
2
+
3
+ Changes in v1.2.0:
4
+
5
+ - `base-builder-jvm` has been updated to use the lastest aixcc-jazzer ref, adjusting the OsCmdInjection sanitizer.
6
+ - This adjustment adds some safety measures around OsCmdInjection to reduce risk and reduce potential
7
+ unintentional crash-state explosion when dealing with such vulnerabilities.
8
+ - `helper.py` commands `build_image`, `build_fuzzers`, and `shell` have added optional flags to control docker image tags.
9
+ - Adds the flag `--docker_image_tag TAG` to the commands. This is entirely optional and backwards
10
+ compatible, but can allow control over the project-image docker tag, enabling easier parallel processing.
11
+ - `helper.py reproduce` has an added optional flag to reproduce with docker running in non-privileged mode.
12
+ - `helper.py reproduce` has an added optional flag to timeout when the reproduce subprocess hangs.
13
+ - This enables crash detection to handle cases where sanitizers are hit, yet for various reasons the
14
+ reproduce subprocess does not resolve and hangs indefinitely. If `timeout` is set, when the reproduce
15
+ subprocess does not resolve within `timeout` seconds, reproduce will end the subprocess and return with code 124.
16
+
17
+ Changes in v1.1.0:
18
+
19
+ - The state of oss-fuzz-aixcc has been synced with upstream changes at 162f2ab818f5992b66486a4d06cb0e3c88c37773.
20
+ - `helper.py build_fuzzers` with local source now matches behavior of non-local source, keeping the build state clean between runs.
21
+ - `base-image` has been updated to default its locale to C.UTF-8 instead of POSIX.
22
+
23
+ This is a competition fork of oss-fuzz which is guaranteed to be
24
+ compatible with the AFC challenges. This fork is designed to remain
25
+ fully backwards compatible with the public/upstream oss-fuzz, and
26
+ thus competition challenges will reflect realistic real-world repositories.
27
+
28
+ ***Other than base-image changes, the projects files have not been touched
29
+ in this repository. The list of projects in the projects directory does
30
+ not reflect which projects will be used in any AFC round.***
31
+
32
+ Competitors are recommended to test their CRS against public repositories using this competition fork.
33
+ Competitors are recommended to view the [example-crs-architecture] repository's
34
+ [example-challenge-evaluation] scripts to see details on how this fuzz tooling is used during competition.
35
+
36
+ [example-crs-arhictecture]: https://github.com/aixcc-finals/example-crs-architecture
37
+ [example-challenge-evaluation]: https://github.com/aixcc-finals/example-crs-architecture/tree/main/example-challenge-evaluation
38
+
39
+ Example basic usage of the helper script is below. **Note: When working with local source, you must pass the local
40
+ source repository into the scripts as detailed below.**
41
+
42
+ ```bash
43
+ # Build the project image and pull AFC base images
44
+ infra/helper.py build_image --pull <project_name>
45
+
46
+ # Build the fuzzer harnesses for the project, using local source
47
+ infra/helper.py build_fuzzers --clean --sanitizer <sanitizer> --engine <engine> <project_name> <path-to-local-src>
48
+
49
+ # Check all fuzzer harnesses for build
50
+ infra/helper.py check_build --sanitizer <sanitizer> --engine <engine> <project_name>
51
+
52
+ # Reproduce the testcase
53
+ # optionally use --propagate_exit_codes
54
+ infra/helper.py reproduce <project_name> <harness_name> <path-to-data-blob>
55
+ ```
56
+
57
+ ---
58
+
59
+ # OSS-Fuzz: Continuous Fuzzing for Open Source Software
60
+
61
+ [Fuzz testing] is a well-known technique for uncovering programming errors in
62
+ software. Many of these detectable errors, like [buffer overflow], can have
63
+ serious security implications. Google has found [thousands] of security
64
+ vulnerabilities and stability bugs by deploying [guided in-process fuzzing of
65
+ Chrome components], and we now want to share that service with the open source
66
+ community.
67
+
68
+ [Fuzz testing]: https://en.wikipedia.org/wiki/Fuzz_testing
69
+ [buffer overflow]: https://en.wikipedia.org/wiki/Buffer_overflow
70
+ [thousands]: https://issues.chromium.org/issues?q=label:Stability-LibFuzzer%20-status:Duplicate,WontFix
71
+ [guided in-process fuzzing of Chrome components]: https://security.googleblog.com/2016/08/guided-in-process-fuzzing-of-chrome.html
72
+
73
+ In cooperation with the [Core Infrastructure Initiative] and the [OpenSSF],
74
+ OSS-Fuzz aims to make common open source software more secure and stable by
75
+ combining modern fuzzing techniques with scalable, distributed execution.
76
+ Projects that do not qualify for OSS-Fuzz (e.g. closed source) can run their own
77
+ instances of [ClusterFuzz] or [ClusterFuzzLite].
78
+
79
+ [Core Infrastructure Initiative]: https://www.coreinfrastructure.org/
80
+ [OpenSSF]: https://www.openssf.org/
81
+
82
+ We support the [libFuzzer], [AFL++], and [Honggfuzz] fuzzing engines in
83
+ combination with [Sanitizers], as well as [ClusterFuzz], a distributed fuzzer
84
+ execution environment and reporting tool.
85
+
86
+ [libFuzzer]: https://llvm.org/docs/LibFuzzer.html
87
+ [AFL++]: https://github.com/AFLplusplus/AFLplusplus
88
+ [Honggfuzz]: https://github.com/google/honggfuzz
89
+ [Sanitizers]: https://github.com/google/sanitizers
90
+ [ClusterFuzz]: https://github.com/google/clusterfuzz
91
+ [ClusterFuzzLite]: https://google.github.io/clusterfuzzlite/
92
+
93
+ Currently, OSS-Fuzz supports C/C++, Rust, Go, Python, Java/JVM, and JavaScript code. Other languages
94
+ supported by [LLVM] may work too. OSS-Fuzz supports fuzzing x86_64 and i386
95
+ builds.
96
+
97
+ [LLVM]: https://llvm.org
98
+
99
+ ## Overview
100
+ ![OSS-Fuzz process diagram](docs/images/process.png)
101
+
102
+ ## Documentation
103
+ Read our [detailed documentation] to learn how to use OSS-Fuzz.
104
+
105
+ [detailed documentation]: https://google.github.io/oss-fuzz
106
+
107
+ ## Trophies
108
+ As of August 2023, OSS-Fuzz has helped identify and fix over [10,000] vulnerabilities and [36,000] bugs across [1,000] projects.
109
+
110
+ [10,000]: https://bugs.chromium.org/p/oss-fuzz/issues/list?q=Type%3DBug-Security%20label%3Aclusterfuzz%20-status%3ADuplicate%2CWontFix&can=1
111
+ [36,000]: https://bugs.chromium.org/p/oss-fuzz/issues/list?q=Type%3DBug%20label%3Aclusterfuzz%20-status%3ADuplicate%2CWontFix&can=1
112
+ [1,000]: https://github.com/google/oss-fuzz/tree/master/projects
113
+
114
+ ## Blog posts
115
+ * 2023-08-16 - [AI-Powered Fuzzing: Breaking the Bug Hunting Barrier]
116
+ * 2023-02-01 - [Taking the next step: OSS-Fuzz in 2023]
117
+ * 2022-09-08 - [Fuzzing beyond memory corruption: Finding broader classes of vulnerabilities automatically]
118
+ * 2021-12-16 - [Improving OSS-Fuzz and Jazzer to catch Log4Shell]
119
+ * 2021-03-10 - [Fuzzing Java in OSS-Fuzz]
120
+ * 2020-12-07 - [Improving open source security during the Google summer internship program]
121
+ * 2020-10-09 - [Fuzzing internships for Open Source Software]
122
+ * 2018-11-06 - [A New Chapter for OSS-Fuzz]
123
+ * 2017-05-08 - [OSS-Fuzz: Five months later, and rewarding projects]
124
+ * 2016-12-01 - [Announcing OSS-Fuzz: Continuous fuzzing for open source software]
125
+
126
+ [AI-Powered Fuzzing: Breaking the Bug Hunting Barrier]: https://security.googleblog.com/2023/08/ai-powered-fuzzing-breaking-bug-hunting.html
127
+ [Announcing OSS-Fuzz: Continuous fuzzing for open source software]: https://opensource.googleblog.com/2016/12/announcing-oss-fuzz-continuous-fuzzing.html
128
+ [OSS-Fuzz: Five months later, and rewarding projects]: https://opensource.googleblog.com/2017/05/oss-fuzz-five-months-later-and.html
129
+ [A New Chapter for OSS-Fuzz]: https://security.googleblog.com/2018/11/a-new-chapter-for-oss-fuzz.html
130
+ [Fuzzing internships for Open Source Software]: https://security.googleblog.com/2020/10/fuzzing-internships-for-open-source.html
131
+ [Improving open source security during the Google summer internship program]: https://security.googleblog.com/2020/12/improving-open-source-security-during.html
132
+ [Fuzzing Java in OSS-Fuzz]: https://security.googleblog.com/2021/03/fuzzing-java-in-oss-fuzz.html
133
+ [Improving OSS-Fuzz and Jazzer to catch Log4Shell]: https://security.googleblog.com/2021/12/improving-oss-fuzz-and-jazzer-to-catch.html
134
+ [Fuzzing beyond memory corruption: Finding broader classes of vulnerabilities automatically]: https://security.googleblog.com/2022/09/fuzzing-beyond-memory-corruption.html
135
+ [Taking the next step: OSS-Fuzz in 2023]: https://security.googleblog.com/2023/02/taking-next-step-oss-fuzz-in-2023.html
local-test-curl-delta-01/fuzz-tooling/docs/.gitignore ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ _site
2
+ .bundle
3
+ .sass-cache
4
+ .jekyll-metadata
5
+ vendor
local-test-curl-delta-01/fuzz-tooling/docs/404.html ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ layout: default
3
+ ---
4
+
5
+ <style type="text/css" media="screen">
6
+ .container {
7
+ margin: 10px auto;
8
+ max-width: 600px;
9
+ text-align: center;
10
+ }
11
+ h1 {
12
+ margin: 30px 0;
13
+ font-size: 4em;
14
+ line-height: 1;
15
+ letter-spacing: -1px;
16
+ }
17
+ </style>
18
+
19
+ <div class="container">
20
+ <h1>404</h1>
21
+
22
+ <p><strong>Page not found :(</strong></p>
23
+ </div>
local-test-curl-delta-01/fuzz-tooling/docs/Gemfile ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ source "https://rubygems.org"
2
+ gem 'github-pages', group: :jekyll_plugins
3
+
4
+ gem "webrick", "~> 1.8"
local-test-curl-delta-01/fuzz-tooling/docs/README.md ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Readme
2
+
3
+ Use the following instructions to make documentation changes locally.
4
+
5
+ ## Prerequisites
6
+ ```bash
7
+ $ sudo apt install ruby bundler
8
+ $ bundle config set path 'vendor/bundle'
9
+ $ bundle install
10
+ ```
11
+
12
+ ## Serving locally
13
+ ```bash
14
+ $ bundle exec jekyll serve
15
+ ```
16
+
17
+ ## Theme documentation
18
+ We are using the [just the docs](https://just-the-docs.github.io/just-the-docs/)
19
+ theme.
local-test-curl-delta-01/fuzz-tooling/docs/_config.yml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Welcome to Jekyll!
2
+ #
3
+ # This config file is meant for settings that affect your whole blog, values
4
+ # which you are expected to set up once and rarely edit after that. If you find
5
+ # yourself editing this file very often, consider using Jekyll's data files
6
+ # feature for the data you need to update frequently.
7
+ #
8
+ # For technical reasons, this file is *NOT* reloaded automatically when you use
9
+ # 'bundle exec jekyll serve'. If you change this file, please restart the server process.
10
+
11
+ # Site settings
12
+ # These are used to personalize your new site. If you look in the HTML files,
13
+ # you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
14
+ # You can create any custom variable you would like, and they will be accessible
15
+ # in the templates via {{ site.myvariable }}.
16
+ title: OSS-Fuzz
17
+ description: Documentation for OSS-Fuzz
18
+ baseurl: "/oss-fuzz" # the subpath of your site, e.g. /blog
19
+ url: "" # the base hostname & protocol for your site, e.g. http://example.com
20
+
21
+ # Build settings
22
+ markdown: kramdown
23
+ remote_theme: pmarsceill/just-the-docs
24
+ search_enabled: true
25
+
26
+ ga_tracking: G-LRX1V3S5P
27
+
28
+ aux_links:
29
+ "OSS-Fuzz on GitHub":
30
+ - https://github.com/google/oss-fuzz
31
+
32
+ # Exclude from processing.
33
+ exclude:
34
+ - Gemfile
35
+ - Gemfile.lock
36
+ - node_modules
37
+ - vendor/bundle/
38
+ - vendor/cache/
39
+ - vendor/gems/
40
+ - vendor/ruby/
local-test-curl-delta-01/fuzz-tooling/docs/faq.md ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ layout: default
3
+ title: FAQ
4
+ nav_order: 7
5
+ permalink: /faq/
6
+ ---
7
+
8
+ # Frequently Asked Questions
9
+
10
+ - TOC
11
+ {:toc}
12
+ ---
13
+
14
+ ## Where can I learn more about fuzzing?
15
+
16
+ We recommend reading [libFuzzer tutorial] and the other docs in [google/fuzzing]
17
+ repository. These and some other resources are listed on the
18
+ [useful links]({{ site.baseurl }}/reference/useful-links/#tutorials) page.
19
+
20
+ [google/fuzzing]: https://github.com/google/fuzzing/tree/master/docs
21
+ [libFuzzer tutorial]: https://github.com/google/fuzzing/blob/master/tutorial/libFuzzerTutorial.md
22
+
23
+ ## What kind of projects are you accepting?
24
+
25
+ We accept established projects that have a critical impact on infrastructure and
26
+ user security. We will consider each request on a case-by-case basis, but some
27
+ things we keep in mind are:
28
+
29
+ - Exposure to remote attacks (e.g. libraries that are used to process
30
+ untrusted input).
31
+ - Number of users/other projects depending on this project.
32
+
33
+ We hope to relax this requirement in the future though, so keep an eye out even
34
+ if we are not able to accept your project at this time!
35
+
36
+ ## How can I find potential fuzz targets in my open source project?
37
+
38
+ You should look for places in your code that:
39
+
40
+ - consume un-trusted data from users or from the network.
41
+ - consume complex input data even if it's 'trusted'.
42
+ - use an algorithm that has two or more implementations
43
+ (to verify their equivalence).
44
+ - look for existing fuzz target [examples](https://github.com/google/oss-fuzz/tree/master/projects)
45
+ and find similarities.
46
+
47
+ ## Where can I store fuzz target sources and the build script if it's not yet accepted upstream?
48
+
49
+ Fuzz target sources as well as the build script may temporarily live inside the
50
+ `projects/<your_project>` directory in the OSS-Fuzz repository. Note that we do
51
+ not accept integrations that rely on forked repositories. Refer to the
52
+ [ideal integration guide] for the preferred long term solution.
53
+
54
+ ## My project is not open source. Can I use OSS-Fuzz?
55
+
56
+ You cannot use OSS-Fuzz, but you can use [ClusterFuzz] which OSS-Fuzz is based
57
+ on. ClusterFuzz is an open-source fuzzing infrastructure that you can deploy in
58
+ your own environment and run continuously at scale.
59
+
60
+ OSS-Fuzz is a production instance of ClusterFuzz, plus the code living in
61
+ [OSS-Fuzz repository]: build scripts, `project.yaml` files with contacts, etc.
62
+
63
+ [OSS-Fuzz repository]: https://github.com/google/oss-fuzz
64
+
65
+ ## Why do you use a [different issue tracker](https://bugs.chromium.org/p/oss-fuzz/issues/list) for reporting bugs in OSS projects?
66
+
67
+ Security access control is important for the kind of issues that OSS-Fuzz detects,
68
+ hence why by default issues are only opened on the OSS-Fuzz tracker.
69
+ You can opt-in to have them on Github as well by adding the `file_github_issue`
70
+ attribute to your `project.yaml` file. Note that this is only for visibility's
71
+ purpose, and that the actual details can be found by following the link to the
72
+ OSS-Fuzz tracker.
73
+
74
+ ## Why do you require a Google account for authentication?
75
+
76
+ Our [ClusterFuzz]({{ site.baseurl }}/further-reading/clusterfuzz) fuzzing
77
+ infrastructure and [issue tracker](https://bugs.chromium.org/p/oss-fuzz/issues/list)
78
+ require a Google account for authentication. Note that an alternate email
79
+ address associated with a Google account does not work due to appengine api
80
+ limitations.
81
+
82
+ ## Why do you use Docker?
83
+
84
+ Building fuzzers requires building your project with a fresh Clang compiler and
85
+ special compiler flags. An easy-to-use Docker image is provided to simplify
86
+ toolchain distribution. This also simplifies our support for a variety of Linux
87
+ distributions and provides a reproducible environment for fuzzer
88
+ building and execution.
89
+
90
+ ## How do you handle timeouts and OOMs?
91
+
92
+ If a single input to a [fuzz target]({{ site.baseurl }}/reference/glossary/#fuzz-target)
93
+ requires more than **~25 seconds** or more than **2.5GB RAM** to process, we
94
+ report this as a timeout or an OOM (out-of-memory) bug
95
+ (examples: [timeouts](https://bugs.chromium.org/p/oss-fuzz/issues/list?can=1&q=%22Crash+Type%3A+Timeout%22),
96
+ [OOMs](https://bugs.chromium.org/p/oss-fuzz/issues/list?can=1&q="Crash+Type%3A+Out-of-memory")).
97
+ This may or may not be considered as a real bug by the project owners,
98
+ but nevertheless we treat all timeouts and OOMs as bugs
99
+ since they significantly reduce the efficiency of fuzzing.
100
+
101
+ Remember that fuzzing is executed with AddressSanitizer or other
102
+ sanitizers which introduces a certain overhead in RAM and CPU.
103
+
104
+ We currently do not have a good way to deduplicate timeout or OOM bugs.
105
+ So, we report only one timeout and only one OOM bug per fuzz target.
106
+ Once that bug is fixed, we will file another one, and so on.
107
+
108
+ Currently we do not offer ways to change the memory and time limits.
109
+
110
+ ## Can I launch an additional process (e.g. a daemon) from my fuzz target?
111
+
112
+ No. In order to get all the benefits of in-process, coverage-guided fuzz testing,
113
+ it is required to run everything inside a single process. Any child processes
114
+ created outside the main process introduces heavy launch overhead and is not
115
+ monitored for code coverage.
116
+
117
+ Another rule of thumb is: "the smaller fuzz target is, the better it is". It is
118
+ expected that your project will have many fuzz targets to test different
119
+ components, instead of a single fuzz target trying to cover everything.
120
+ Think of fuzz target as a unit test, though it is much more powerful since it
121
+ helps to test millions of data permutations rather than just one.
122
+
123
+ ## What if my fuzz target finds a bug in another project (dependency) ?
124
+
125
+ Every bug report has a crash stack-trace that shows where the crash happened.
126
+ Using that, you can debug the root cause and see which category the bug falls in:
127
+
128
+ - If this is a bug is due to an incorrect usage of the dependent project's API
129
+ in your project, then you need to fix your usage to call the API correctly.
130
+ - If this is a real bug in the dependent project, then you should CC the
131
+ maintainers of that project on the bug. Once CCed, they will get automatic
132
+ access to all the information necessary to reproduce the issue. If this project
133
+ is maintained in OSS-Fuzz, you can search for contacts in the respective
134
+ project.yaml file.
135
+
136
+ ## What if my fuzzer does not find anything?
137
+
138
+ If your fuzz target is running for many days and does not find bugs or new
139
+ coverage, it may mean several things:
140
+ - We've covered all reachable code. In order to cover more code we need more
141
+ fuzz targets.
142
+ - The [seed corpus]({{ site.baseurl }}/getting-started/new-project-guide#seed-corpus) is not good enough and the
143
+ fuzzing engine(s) are not able to go deeper based on the existing seeds.
144
+ Need to add more seeds.
145
+ - There is some crypto/crc stuff in the code that will prevent any fuzzing
146
+ engine from going deeper, in which case the crypto should be disabled in
147
+ [fuzzing mode](https://llvm.org/docs/LibFuzzer.html#fuzzer-friendly-build-mode).
148
+ Examples: [openssl](https://github.com/openssl/openssl/tree/master/fuzz#reproducing-issues),
149
+ [boringssl](https://boringssl.googlesource.com/boringssl/+/HEAD/FUZZING.md#Fuzzer-mode)
150
+ - It is also possible that the fuzzer is running too slow
151
+ (you may check the speed of your targets at https://oss-fuzz.com/)
152
+
153
+ In either case, look at the
154
+ [coverage reports]({{ site.baseurl }}/further-reading/clusterfuzz#coverage-reports)
155
+ for your target(s) and figure out why some parts of the code are not covered.
156
+
157
+ ## What if my fuzzer does not find new coverage or bugs after a while?
158
+
159
+ It is common for fuzzers to plateau and stop finding new coverage or bugs.
160
+ [Fuzz Introspector](https://github.com/ossf/fuzz-introspector) helps you
161
+ evaluate your fuzzers' performance.
162
+ It can help you identify bottlenecks causing your fuzzers to plateau.
163
+ It provides aggregated and individual fuzzer reachability and coverage reports.
164
+ Developers can either introduce a new fuzz target or modify an existing one to
165
+ reach previously unreachable code.
166
+ Here are
167
+ [case studies](https://github.com/ossf/fuzz-introspector/blob/main/doc/CaseStudies.md)
168
+ where Fuzz Introspector helped developers improve fuzzing of a project.
169
+ Fuzz Introspector reports are available on the [OSS-Fuzz homepage](https://oss-fuzz.com/)
170
+ or through this [index](http://oss-fuzz-introspector.storage.googleapis.com/index.html).
171
+
172
+ Developers can also use Fuzz Introspector on their local machines.
173
+ Detailed instructions are available
174
+ [here](https://github.com/ossf/fuzz-introspector/tree/main/oss_fuzz_integration#build-fuzz-introspector-with-oss-fuzz).
175
+
176
+ ## Why are code coverage reports public?
177
+
178
+ We work with open source projects and try to keep as much information public as
179
+ possible. We believe that public code coverage reports do not put users at risk,
180
+ as they do not indicate the presence of bugs or lack thereof.
181
+
182
+ ## Why is the coverage command complaining about format compatibility issues?
183
+
184
+ This may happen if the Docker images fetched locally become out of sync. Make
185
+ sure you run the following command to pull the most recent images:
186
+
187
+ ```bash
188
+ $ python infra/helper.py pull_images
189
+ ```
190
+
191
+ Please refer to
192
+ [code coverage]({{ site.baseurl }}/advanced-topics/code-coverage/) for detailed
193
+ information on code coverage generation.
194
+
195
+ ## What happens when I rename a fuzz target ?
196
+
197
+ If you rename your fuzz targets, the existing bugs for those targets will get
198
+ closed and fuzzing will start from scratch from a fresh corpora
199
+ (seed corpus only). Similar corpora will get accumulated over time depending on
200
+ the number of cpu cycles that original fuzz target has run. If this is not
201
+ desirable, make sure to copy the accumulated corpora from the original fuzz
202
+ target (instructions to download
203
+ [here]({{ site.baseurl }}/advanced-topics/corpora/#downloading-the-corpus)) and
204
+ restore it to the new GCS location later (instruction to find the
205
+ new location [here]({{ site.baseurl }}/advanced-topics/corpora/#viewing-the-corpus-for-a-fuzz-target)).
206
+
207
+ ## Does OSS-Fuzz support AFL or honggfuzz or Centipede?
208
+
209
+ OSS-Fuzz *uses* the following
210
+ [fuzzing engines]({{ site.baseurl }}/reference/glossary/#fuzzing-engine):
211
+
212
+ 1. [libFuzzer](https://llvm.org/docs/LibFuzzer.html).
213
+ 1. [AFL++](https://github.com/AFLplusplus/AFLplusplus), an improved and
214
+ well-maintained version of [AFL](https://lcamtuf.coredump.cx/afl/).
215
+ 1. [Honggfuzz](https://github.com/google/honggfuzz).
216
+ 1. [Centipede (Experimental)](https://github.com/google/centipede).
217
+
218
+ Follow the [new project guide] and OSS-Fuzz will use all its fuzzing engines
219
+ on your code.
220
+
221
+ ## What are the specs on your machines?
222
+
223
+ OSS-Fuzz builders have 32CPU/28.8GB RAM.
224
+
225
+ Fuzzing machines only have a single core and fuzz targets should not use more
226
+ than 2.5GB of RAM.
227
+
228
+ ## Are there any restrictions on using test cases / corpora generated by OSS-Fuzz?
229
+
230
+ No, you can freely use (i.e. share, add to your repo, etc.) the test cases and
231
+ corpora generated by OSS-Fuzz. OSS-Fuzz infrastructure is fully open source
232
+ (including [ClusterFuzz], various fuzzing engines, and other dependencies). We
233
+ have no intent to restrict the use of the artifacts produced by OSS-Fuzz.
234
+
235
+ [ClusterFuzz]: https://github.com/google/clusterfuzz
236
+ [new project guide]: {{ site.baseurl }}/getting-started/new-project-guide/
237
+ [ideal integration guide]: {{ site.baseurl }}/getting-started/new-project-guide/
local-test-curl-delta-01/fuzz-tooling/docs/favicon.ico ADDED
local-test-curl-delta-01/fuzz-tooling/docs/glossary.md ADDED
@@ -0,0 +1 @@
 
 
1
+ This page has moved [here](https://google.github.io/oss-fuzz/reference/glossary/)
local-test-curl-delta-01/fuzz-tooling/docs/ideal_integration.md ADDED
@@ -0,0 +1 @@
 
 
1
+ This page has moved [here](https://google.github.io/oss-fuzz/advanced-topics/ideal-integration)
local-test-curl-delta-01/fuzz-tooling/docs/index.md ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ layout: default
3
+ title: OSS-Fuzz
4
+ permalink: /
5
+ nav_order: 1
6
+ has_children: true
7
+ has_toc: false
8
+ ---
9
+
10
+ # OSS-Fuzz
11
+
12
+ [Fuzz testing] is a well-known technique for uncovering programming errors in
13
+ software. Many of these detectable errors, like [buffer overflow], can have
14
+ serious security implications. Google has found [thousands] of security
15
+ vulnerabilities and stability bugs by deploying [guided in-process fuzzing of
16
+ Chrome components], and we now want to share that service with the open source
17
+ community.
18
+
19
+ [Fuzz testing]: https://en.wikipedia.org/wiki/Fuzz_testing
20
+ [buffer overflow]: https://en.wikipedia.org/wiki/Buffer_overflow
21
+ [thousands]: https://bugs.chromium.org/p/chromium/issues/list?q=label%3AStability-LibFuzzer%2CStability-AFL%20-status%3ADuplicate%2CWontFix&can=1
22
+ [guided in-process fuzzing of Chrome components]: https://security.googleblog.com/2016/08/guided-in-process-fuzzing-of-chrome.html
23
+
24
+ In cooperation with the [Core Infrastructure Initiative] and the [OpenSSF],
25
+ OSS-Fuzz aims to make common open source software more secure and stable by
26
+ combining modern fuzzing techniques with scalable, distributed execution.
27
+ Projects that do not qualify for OSS-Fuzz (e.g. closed source) can run their own
28
+ instances of [ClusterFuzz] or [ClusterFuzzLite].
29
+
30
+ [Core Infrastructure Initiative]: https://www.coreinfrastructure.org/
31
+ [OpenSSF]: https://www.openssf.org/
32
+
33
+ We support the [libFuzzer], [AFL++], [Honggfuzz], and [Centipede] fuzzing engines in
34
+ combination with [Sanitizers], as well as [ClusterFuzz], a distributed fuzzer
35
+ execution environment and reporting tool.
36
+
37
+ [libFuzzer]: https://llvm.org/docs/LibFuzzer.html
38
+ [AFL++]: https://github.com/AFLplusplus/AFLplusplus
39
+ [Honggfuzz]: https://github.com/google/honggfuzz
40
+ [Centipede]: https://github.com/google/centipede
41
+ [Sanitizers]: https://github.com/google/sanitizers
42
+ [ClusterFuzz]: https://github.com/google/clusterfuzz
43
+ [ClusterFuzzLite]: https://google.github.io/clusterfuzzlite/
44
+
45
+ Currently, OSS-Fuzz supports C/C++, Rust, Go, Python and Java/JVM code. Other
46
+ languages supported by [LLVM] may work too. OSS-Fuzz supports fuzzing x86_64
47
+ and i386 builds.
48
+
49
+ [LLVM]: https://llvm.org
50
+
51
+
52
+ ## Project history
53
+ OSS-Fuzz was launched in 2016 in response to the
54
+ [Heartbleed] vulnerability, discovered in [OpenSSL], one of the
55
+ most popular open source projects for encrypting web traffic. The vulnerability
56
+ had the potential to affect almost every internet user, yet was caused by a
57
+ relatively simple memory buffer overflow bug that could have been detected by
58
+ fuzzing—that is, by running the code on randomized inputs to intentionally cause
59
+ unexpected behaviors or crashes. At the time, though, fuzzing
60
+ was not widely used and was cumbersome for developers, requiring extensive
61
+ manual effort.
62
+
63
+ Google created OSS-Fuzz to fill this gap: it's a free service that runs fuzzers
64
+ for open source projects and privately alerts developers to the bugs detected.
65
+ Since its launch, OSS-Fuzz has become a critical service for the open source
66
+ community, growing beyond C/C++ to
67
+ detect problems in memory-safe languages such as Go, Rust, and Python.
68
+
69
+ [Heartbleed]: https://heartbleed.com/
70
+ [OpenSSL]: https://www.openssl.org/
71
+
72
+ ## Learn more about fuzzing
73
+
74
+ This documentation describes how to use OSS-Fuzz service for your open source
75
+ project. To learn more about fuzzing in general, we recommend reading [libFuzzer
76
+ tutorial] and the other docs in [google/fuzzing] repository. These and some
77
+ other resources are listed on the [useful links] page.
78
+
79
+ [google/fuzzing]: https://github.com/google/fuzzing/tree/master/docs
80
+ [libFuzzer tutorial]: https://github.com/google/fuzzing/blob/master/tutorial/libFuzzerTutorial.md
81
+ [useful links]: {{ site.baseurl }}/reference/useful-links/#tutorials
82
+
83
+ ## Trophies
84
+ As of August 2023, OSS-Fuzz has helped identify and fix over [10,000] vulnerabilities and [36,000] bugs across [1,000] projects.
85
+
86
+ [10,000]: https://bugs.chromium.org/p/oss-fuzz/issues/list?q=Type%3DBug-Security%20label%3Aclusterfuzz%20-status%3ADuplicate%2CWontFix&can=1
87
+ [36,000]: https://bugs.chromium.org/p/oss-fuzz/issues/list?q=Type%3DBug%20label%3Aclusterfuzz%20-status%3ADuplicate%2CWontFix&can=1
88
+ [1,000]: https://github.com/google/oss-fuzz/tree/master/projects
local-test-curl-delta-01/fuzz-tooling/docs/new_project_guide.md ADDED
@@ -0,0 +1 @@
 
 
1
+ This page has moved [here](https://google.github.io/oss-fuzz/getting-started/new-project-guide/)
local-test-curl-delta-01/fuzz-tooling/docs/reproducing.md ADDED
@@ -0,0 +1 @@
 
 
1
+ This page has moved [here](https://google.github.io/oss-fuzz/advanced-topics/reproducing)
local-test-curl-delta-01/fuzz-tooling/infra/.dockerignore ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ cifuzz/test_data/*
2
+
3
+ # Copied from .gitignore.
4
+ .vscode/
5
+ *.pyc
6
+ build
7
+ *~
8
+ .DS_Store
9
+ *.swp
local-test-curl-delta-01/fuzz-tooling/infra/MAINTAINERS.csv ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ Name,Email,Github Username
2
+ Adam Korcz,adam@adalogics.com,AdamKorcz
3
+ David Korczynski,david@adalogics.com,DavidKorczynski
4
+ Dongge Liu,donggeliu@google.com,Alan32Liu
5
+ Holly Gong,gongh@google.com,hogo6002
6
+ Jonathan Metzman,metzman@google.com,jonathanmetzman
7
+ Oliver Chang,ochang@google.com,oliverchang
local-test-curl-delta-01/fuzz-tooling/infra/README.md ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # infra
2
+ > OSS-Fuzz project infrastructure
3
+
4
+ Core infrastructure:
5
+ * [`base-images`](base-images/) - docker images for building fuzz targets & corresponding jenkins
6
+ pipeline.
7
+
8
+ Continuous Integration infrastructure:
9
+
10
+ * [`ci`](ci/) - script to build projects in CI.
11
+
12
+ ## helper.py
13
+ > script to automate common docker operations
14
+
15
+ | Command | Description |
16
+ |---------|-------------
17
+ | `generate` | Generates skeleton files for a new project |
18
+ | `build_image` | Builds a docker image for a given project |
19
+ | `build_fuzzers` | Builds fuzz targets for a given project |
20
+ | `run_fuzzer` | Runs a fuzz target in a docker container |
21
+ | `coverage` | Runs fuzz target(s) in a docker container and generates a code coverage report. See [Code Coverage doc](https://google.github.io/oss-fuzz/advanced-topics/code-coverage/) |
22
+ | `reproduce` | Runs a testcase to reproduce a crash |
23
+ | `shell` | Starts a shell inside the docker image for a project |
local-test-curl-delta-01/fuzz-tooling/infra/__pycache__/templates.cpython-312.pyc ADDED
Binary file (3.04 kB). View file
 
local-test-curl-delta-01/fuzz-tooling/infra/base-images/README.md ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ Building all infra images:
2
+
3
+ ```bash
4
+ # run from project root
5
+ infra/base-images/all.sh
6
+ ```
local-test-curl-delta-01/fuzz-tooling/infra/base-images/aixcc_build_all.sh ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash -eux
2
+
3
+ if [ "$1" = "--cache-from" ]; then
4
+ PULL_CACHE=1
5
+ shift
6
+ CACHE_TAG="${1//\//-}" # s/\//-/g -> for branch names that contain slashes
7
+ shift
8
+ elif [ "$1" = "--cache-to" ]; then
9
+ PUSH_CACHE=1
10
+ shift
11
+ CACHE_TAG="${1//\//-}" # s/\//-/g -> for branch names that contain slashes
12
+ shift
13
+ fi
14
+
15
+ ARG_TAG="$1"
16
+ shift
17
+
18
+ BASE_IMAGES=(
19
+ "ghcr.io/aixcc-finals/base-image infra/base-images/base-image"
20
+ "ghcr.io/aixcc-finals/base-clang infra/base-images/base-clang"
21
+ "ghcr.io/aixcc-finals/base-builder infra/base-images/base-builder"
22
+ "ghcr.io/aixcc-finals/base-builder-go infra/base-images/base-builder-go"
23
+ "ghcr.io/aixcc-finals/base-builder-jvm infra/base-images/base-builder-jvm"
24
+ "ghcr.io/aixcc-finals/base-builder-python infra/base-images/base-builder-python"
25
+ "ghcr.io/aixcc-finals/base-builder-rust infra/base-images/base-builder-rust"
26
+ "ghcr.io/aixcc-finals/base-builder-ruby infra/base-images/base-builder-ruby"
27
+ "ghcr.io/aixcc-finals/base-builder-swift infra/base-images/base-builder-swift"
28
+ "ghcr.io/aixcc-finals/base-runner infra/base-images/base-runner"
29
+ "ghcr.io/aixcc-finals/base-runner-debug infra/base-images/base-runner-debug"
30
+ )
31
+
32
+ for tuple in "${BASE_IMAGES[@]}"; do
33
+ read -r image path <<< "$tuple"
34
+
35
+ if [ "${PULL_CACHE+x}" ]; then
36
+
37
+ docker buildx build \
38
+ --build-arg IMG_TAG="${ARG_TAG}" \
39
+ --cache-from=type=registry,ref="${image}:${CACHE_TAG}" \
40
+ --tag "${image}:${ARG_TAG}" --push "$@" "${path}"
41
+
42
+ elif [ "${PUSH_CACHE+x}" ]; then
43
+
44
+ docker buildx build \
45
+ --build-arg IMG_TAG="${ARG_TAG}" \
46
+ --cache-from=type=registry,ref="${image}:${CACHE_TAG}" \
47
+ --cache-to=type=registry,ref="${image}:${CACHE_TAG}",mode=max \
48
+ --tag "${image}:${ARG_TAG}" --push "$@" "${path}"
49
+
50
+ else
51
+
52
+ docker buildx build \
53
+ --build-arg IMG_TAG="${ARG_TAG}" \
54
+ --tag "${image}:${ARG_TAG}" --push "$@" "${path}"
55
+
56
+ fi
57
+
58
+ done
59
+
local-test-curl-delta-01/fuzz-tooling/infra/base-images/all.sh ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash -eux
2
+ # Copyright 2016 Google Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ ################################################################################
17
+
18
+ docker build --pull -t ghcr.io/aixcc-finals/base-image "$@" infra/base-images/base-image
19
+ docker build -t ghcr.io/aixcc-finals/base-clang "$@" infra/base-images/base-clang
20
+ docker build -t ghcr.io/aixcc-finals/base-builder "$@" infra/base-images/base-builder
21
+ docker build -t ghcr.io/aixcc-finals/base-builder-go "$@" infra/base-images/base-builder-go
22
+ docker build -t ghcr.io/aixcc-finals/base-builder-jvm "$@" infra/base-images/base-builder-jvm
23
+ docker build -t ghcr.io/aixcc-finals/base-builder-python "$@" infra/base-images/base-builder-python
24
+ docker build -t ghcr.io/aixcc-finals/base-builder-rust "$@" infra/base-images/base-builder-rust
25
+ docker build -t ghcr.io/aixcc-finals/base-builder-ruby "$@" infra/base-images/base-builder-ruby
26
+ docker build -t ghcr.io/aixcc-finals/base-builder-swift "$@" infra/base-images/base-builder-swift
27
+ docker build -t ghcr.io/aixcc-finals/base-runner "$@" infra/base-images/base-runner
28
+ docker build -t ghcr.io/aixcc-finals/base-runner-debug "$@" infra/base-images/base-runner-debug
local-test-curl-delta-01/fuzz-tooling/infra/bisector.py ADDED
@@ -0,0 +1,318 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2019 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """Uses bisection to determine which commit a bug was introduced and fixed.
15
+ This module takes a high and a low commit SHA, a repo name, and a bug.
16
+ The module bisects the high and low commit SHA searching for the location
17
+ where the bug was introduced. It also looks for where the bug was fixed.
18
+ This is done with the following steps:
19
+
20
+
21
+ NOTE: Needs to be run from root of the OSS-Fuzz source checkout.
22
+
23
+ Typical usage example:
24
+ python3 infra/bisector.py
25
+ --old_commit 1e403e9259a1abedf108ab86f711ba52c907226d
26
+ --new_commit f79be4f2330f4b89ea2f42e1c44ca998c59a0c0f
27
+ --fuzz_target rules_fuzzer
28
+ --project_name yara
29
+ --testcase infra/yara_testcase
30
+ --sanitizer address
31
+ """
32
+
33
+ import argparse
34
+ import collections
35
+ import logging
36
+ import os
37
+ import sys
38
+ import tempfile
39
+
40
+ import build_specified_commit
41
+ import helper
42
+ import repo_manager
43
+ import utils
44
+
45
+ Result = collections.namedtuple('Result', ['repo_url', 'commit'])
46
+
47
+ START_MARKERS = [
48
+ '==ERROR',
49
+ '==WARNING',
50
+ ]
51
+
52
+ END_MARKERS = [
53
+ 'SUMMARY:',
54
+ ]
55
+
56
+ DEDUP_TOKEN_MARKER = 'DEDUP_TOKEN:'
57
+
58
+
59
+ class BisectError(Exception):
60
+ """Bisection error."""
61
+
62
+ def __init__(self, message, repo_url):
63
+ super().__init__(message)
64
+ self.repo_url = repo_url
65
+
66
+
67
+ def main():
68
+ """Finds the commit SHA where an error was initally introduced."""
69
+ logging.getLogger().setLevel(logging.INFO)
70
+ utils.chdir_to_root()
71
+ parser = argparse.ArgumentParser(
72
+ description='git bisection for finding introduction of bugs')
73
+
74
+ parser.add_argument('--project_name',
75
+ help='The name of the project where the bug occurred.',
76
+ required=True)
77
+ parser.add_argument('--new_commit',
78
+ help='The newest commit SHA to be bisected.',
79
+ required=True)
80
+ parser.add_argument('--old_commit',
81
+ help='The oldest commit SHA to be bisected.',
82
+ required=True)
83
+ parser.add_argument('--fuzz_target',
84
+ help='The name of the fuzzer to be built.',
85
+ required=True)
86
+ parser.add_argument('--test_case_path',
87
+ help='The path to test case.',
88
+ required=True)
89
+ parser.add_argument('--engine',
90
+ help='The default is "libfuzzer".',
91
+ default='libfuzzer')
92
+ parser.add_argument('--sanitizer',
93
+ default='address',
94
+ help='The default is "address".')
95
+ parser.add_argument('--type',
96
+ choices=['regressed', 'fixed'],
97
+ help='The bisection type.',
98
+ required=True)
99
+ parser.add_argument('--architecture', default='x86_64')
100
+ args = parser.parse_args()
101
+
102
+ build_data = build_specified_commit.BuildData(project_name=args.project_name,
103
+ engine=args.engine,
104
+ sanitizer=args.sanitizer,
105
+ architecture=args.architecture)
106
+
107
+ result = bisect(args.type, args.old_commit, args.new_commit,
108
+ args.test_case_path, args.fuzz_target, build_data)
109
+ if not result.commit:
110
+ logging.error('No error was found in commit range %s:%s', args.old_commit,
111
+ args.new_commit)
112
+ return 1
113
+ if result.commit == args.old_commit:
114
+ logging.error(
115
+ 'Bisection Error: Both the first and the last commits in'
116
+ 'the given range have the same behavior, bisection is not possible. ')
117
+ return 1
118
+ if args.type == 'regressed':
119
+ print('Error was introduced at commit %s' % result.commit)
120
+ elif args.type == 'fixed':
121
+ print('Error was fixed at commit %s' % result.commit)
122
+ return 0
123
+
124
+
125
+ def _get_dedup_token(output):
126
+ """Get dedup token."""
127
+ for line in output.splitlines():
128
+ token_location = line.find(DEDUP_TOKEN_MARKER)
129
+ if token_location == -1:
130
+ continue
131
+
132
+ return line[token_location + len(DEDUP_TOKEN_MARKER):].strip()
133
+
134
+ return None
135
+
136
+
137
+ def _check_for_crash(project_name, fuzz_target, testcase_path):
138
+ """Check for crash."""
139
+
140
+ def docker_run(args, **kwargs):
141
+ del kwargs
142
+ command = ['docker', 'run', '--rm', '--privileged']
143
+ if sys.stdin.isatty():
144
+ command.append('-i')
145
+
146
+ return utils.execute(command + args)
147
+
148
+ logging.info('Checking for crash')
149
+ out, err, return_code = helper.reproduce_impl(
150
+ project=helper.Project(project_name),
151
+ fuzzer_name=fuzz_target,
152
+ valgrind=False,
153
+ env_to_add=[],
154
+ fuzzer_args=[],
155
+ testcase_path=testcase_path,
156
+ run_function=docker_run,
157
+ err_result=(None, None, None))
158
+ if return_code is None:
159
+ return None
160
+
161
+ logging.info('stdout =\n%s', out)
162
+ logging.info('stderr =\n%s', err)
163
+
164
+ # pylint: disable=unsupported-membership-test
165
+ has_start_marker = any(
166
+ marker in out or marker in err for marker in START_MARKERS)
167
+ has_end_marker = any(marker in out or marker in err for marker in END_MARKERS)
168
+ if not has_start_marker or not has_end_marker:
169
+ return None
170
+
171
+ return _get_dedup_token(out + err)
172
+
173
+
174
+ # pylint: disable=too-many-locals
175
+ # pylint: disable=too-many-arguments
176
+ # pylint: disable=too-many-statements
177
+ def _bisect(bisect_type, old_commit, new_commit, testcase_path, fuzz_target,
178
+ build_data):
179
+ """Perform the bisect."""
180
+ # pylint: disable=too-many-branches
181
+ base_builder_repo = build_specified_commit.load_base_builder_repo()
182
+
183
+ with tempfile.TemporaryDirectory() as tmp_dir:
184
+ repo_url, repo_path = build_specified_commit.detect_main_repo(
185
+ build_data.project_name, commit=new_commit)
186
+ if not repo_url or not repo_path:
187
+ raise ValueError('Main git repo can not be determined.')
188
+
189
+ if old_commit == new_commit:
190
+ raise BisectError('old_commit is the same as new_commit', repo_url)
191
+
192
+ # Copy /src from the built Docker container to ensure all dependencies
193
+ # exist. This will be mounted when running them.
194
+ host_src_dir = build_specified_commit.copy_src_from_docker(
195
+ build_data.project_name, tmp_dir)
196
+
197
+ bisect_repo_manager = repo_manager.RepoManager(
198
+ os.path.join(host_src_dir, os.path.basename(repo_path)))
199
+ bisect_repo_manager.fetch_all_remotes()
200
+
201
+ commit_list = bisect_repo_manager.get_commit_list(new_commit, old_commit)
202
+
203
+ old_idx = len(commit_list) - 1
204
+ new_idx = 0
205
+ logging.info('Testing against new_commit (%s)', commit_list[new_idx])
206
+ if not build_specified_commit.build_fuzzers_from_commit(
207
+ commit_list[new_idx],
208
+ bisect_repo_manager,
209
+ host_src_dir,
210
+ build_data,
211
+ base_builder_repo=base_builder_repo):
212
+ raise BisectError('Failed to build new_commit', repo_url)
213
+
214
+ if bisect_type == 'fixed':
215
+ should_crash = False
216
+ elif bisect_type == 'regressed':
217
+ should_crash = True
218
+ else:
219
+ raise BisectError('Invalid bisect type ' + bisect_type, repo_url)
220
+
221
+ expected_error = _check_for_crash(build_data.project_name, fuzz_target,
222
+ testcase_path)
223
+ logging.info('new_commit result = %s', expected_error)
224
+
225
+ if not should_crash and expected_error:
226
+ logging.warning('new_commit crashed but not shouldn\'t. '
227
+ 'Continuing to see if stack changes.')
228
+
229
+ range_valid = False
230
+ for _ in range(2):
231
+ logging.info('Testing against old_commit (%s)', commit_list[old_idx])
232
+ if not build_specified_commit.build_fuzzers_from_commit(
233
+ commit_list[old_idx],
234
+ bisect_repo_manager,
235
+ host_src_dir,
236
+ build_data,
237
+ base_builder_repo=base_builder_repo):
238
+ raise BisectError('Failed to build old_commit', repo_url)
239
+
240
+ if _check_for_crash(build_data.project_name, fuzz_target,
241
+ testcase_path) == expected_error:
242
+ logging.warning('old_commit %s had same result as new_commit %s',
243
+ old_commit, new_commit)
244
+ # Try again on an slightly older commit.
245
+ old_commit = bisect_repo_manager.get_parent(old_commit, 64)
246
+ if not old_commit:
247
+ break
248
+
249
+ commit_list = bisect_repo_manager.get_commit_list(
250
+ new_commit, old_commit)
251
+ old_idx = len(commit_list) - 1
252
+ continue
253
+
254
+ range_valid = True
255
+ break
256
+
257
+ if not range_valid:
258
+ raise BisectError('old_commit had same result as new_commit', repo_url)
259
+
260
+ while old_idx - new_idx > 1:
261
+ curr_idx = (old_idx + new_idx) // 2
262
+ logging.info('Testing against %s (idx=%d)', commit_list[curr_idx],
263
+ curr_idx)
264
+ if not build_specified_commit.build_fuzzers_from_commit(
265
+ commit_list[curr_idx],
266
+ bisect_repo_manager,
267
+ host_src_dir,
268
+ build_data,
269
+ base_builder_repo=base_builder_repo):
270
+ # Treat build failures as if we couldn't repo.
271
+ # TODO(ochang): retry nearby commits?
272
+ old_idx = curr_idx
273
+ continue
274
+
275
+ current_error = _check_for_crash(build_data.project_name, fuzz_target,
276
+ testcase_path)
277
+ logging.info('Current result = %s', current_error)
278
+ if expected_error == current_error:
279
+ new_idx = curr_idx
280
+ else:
281
+ old_idx = curr_idx
282
+ return Result(repo_url, commit_list[new_idx])
283
+
284
+
285
+ # pylint: disable=too-many-locals
286
+ # pylint: disable=too-many-arguments
287
+ def bisect(bisect_type, old_commit, new_commit, testcase_path, fuzz_target,
288
+ build_data):
289
+ """From a commit range, this function caluclates which introduced a
290
+ specific error from a fuzz testcase_path.
291
+
292
+ Args:
293
+ bisect_type: The type of the bisect ('regressed' or 'fixed').
294
+ old_commit: The oldest commit in the error regression range.
295
+ new_commit: The newest commit in the error regression range.
296
+ testcase_path: The file path of the test case that triggers the error
297
+ fuzz_target: The name of the fuzzer to be tested.
298
+ build_data: a class holding all of the input parameters for bisection.
299
+
300
+ Returns:
301
+ The commit SHA that introduced the error or None.
302
+
303
+ Raises:
304
+ ValueError: when a repo url can't be determine from the project.
305
+ """
306
+ try:
307
+ return _bisect(bisect_type, old_commit, new_commit, testcase_path,
308
+ fuzz_target, build_data)
309
+ finally:
310
+ # Clean up projects/ as _bisect may have modified it.
311
+ oss_fuzz_repo_manager = repo_manager.RepoManager(helper.OSS_FUZZ_DIR)
312
+ oss_fuzz_repo_manager.git(['reset', 'projects'])
313
+ oss_fuzz_repo_manager.git(['checkout', 'projects'])
314
+ oss_fuzz_repo_manager.git(['clean', '-fxd', 'projects'])
315
+
316
+
317
+ if __name__ == '__main__':
318
+ main()
local-test-curl-delta-01/fuzz-tooling/infra/bisector_test.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2019 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing perepo_managerissions and
13
+ # limitations under the License.
14
+ """Test the functionality of bisection module:
15
+ 1) Test a known case where an error appears in a regression range.
16
+ 2) Bisect can handle incorrect inputs.
17
+
18
+ IMPORTANT: This test needs to be run with root privileges.
19
+ """
20
+
21
+ import os
22
+ import unittest
23
+
24
+ import bisector
25
+ import build_specified_commit
26
+ import test_repos
27
+
28
+ # Necessary because __file__ changes with os.chdir
29
+ TEST_DIR_PATH = os.path.dirname(os.path.realpath(__file__))
30
+
31
+
32
+ @unittest.skip('Test is too long to be run with presubmit.')
33
+ class BisectIntegrationTests(unittest.TestCase):
34
+ """Class to test the functionality of bisection method."""
35
+
36
+ BISECT_TYPE = 'regressed'
37
+
38
+ def test_bisect_invalid_repo(self):
39
+ """Test the bisection method on a project that does not exist."""
40
+ test_repo = test_repos.INVALID_REPO
41
+ build_data = build_specified_commit.BuildData(
42
+ project_name=test_repo.project_name,
43
+ engine='libfuzzer',
44
+ sanitizer='address',
45
+ architecture='x86_64')
46
+ with self.assertRaises(ValueError):
47
+ bisector.bisect(self.BISECT_TYPE, test_repo.old_commit,
48
+ test_repo.new_commit, test_repo.testcase_path,
49
+ test_repo.fuzz_target, build_data)
50
+
51
+ def test_bisect(self):
52
+ """Test the bisect method on example projects."""
53
+ for test_repo in test_repos.TEST_REPOS:
54
+ if test_repo.new_commit:
55
+ build_data = build_specified_commit.BuildData(
56
+ project_name=test_repo.project_name,
57
+ engine='libfuzzer',
58
+ sanitizer='address',
59
+ architecture='x86_64')
60
+ result = bisector.bisect(self.BISECT_TYPE, test_repo.old_commit,
61
+ test_repo.new_commit, test_repo.testcase_path,
62
+ test_repo.fuzz_target, build_data)
63
+ self.assertEqual(result.commit, test_repo.intro_commit)
64
+
65
+
66
+ if __name__ == '__main__':
67
+ # Change to oss-fuzz main directory so helper.py runs correctly.
68
+ if os.getcwd() != os.path.dirname(TEST_DIR_PATH):
69
+ os.chdir(os.path.dirname(TEST_DIR_PATH))
70
+ unittest.main()
local-test-curl-delta-01/fuzz-tooling/infra/build_fuzzers.Dockerfile ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ ################################################################################
16
+ # Docker image to run fuzzers for CIFuzz (the run_fuzzers action on GitHub
17
+ # actions).
18
+
19
+ FROM ghcr.io/aixcc-finals/cifuzz-base
20
+
21
+ # Python file to execute when the docker container starts up
22
+ # We can't use the env var $OSS_FUZZ_ROOT here. Since it's a constant env var,
23
+ # just expand to '/opt/oss-fuzz'.
24
+ ENTRYPOINT ["python3", "/opt/oss-fuzz/infra/cifuzz/build_fuzzers_entrypoint.py"]
25
+
26
+ WORKDIR ${OSS_FUZZ_ROOT}/infra
27
+
28
+ # Update infra source code.
29
+ ADD . ${OSS_FUZZ_ROOT}/infra
30
+
31
+ RUN python3 -m pip install -r ${OSS_FUZZ_ROOT}/infra/cifuzz/requirements.txt
local-test-curl-delta-01/fuzz-tooling/infra/build_specified_commit.py ADDED
@@ -0,0 +1,410 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2019 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """Module to build a image from a specific commit, branch or pull request.
15
+
16
+ This module is allows each of the OSS Fuzz projects fuzzers to be built
17
+ from a specific point in time. This feature can be used for implementations
18
+ like continuious integration fuzzing and bisection to find errors
19
+ """
20
+ import argparse
21
+ import bisect
22
+ import datetime
23
+ import os
24
+ import collections
25
+ import json
26
+ import logging
27
+ import re
28
+ import shutil
29
+ import tempfile
30
+
31
+ import helper
32
+ import repo_manager
33
+ import retry
34
+ import utils
35
+
36
+ BuildData = collections.namedtuple(
37
+ 'BuildData', ['project_name', 'engine', 'sanitizer', 'architecture'])
38
+
39
+ _GIT_DIR_MARKER = 'gitdir: '
40
+ _IMAGE_BUILD_TRIES = 3
41
+
42
+
43
+ class BaseBuilderRepo:
44
+ """Repo of base-builder images."""
45
+
46
+ def __init__(self):
47
+ self.timestamps = []
48
+ self.digests = []
49
+
50
+ def add_digest(self, timestamp, digest):
51
+ """Add a digest."""
52
+ self.timestamps.append(timestamp)
53
+ self.digests.append(digest)
54
+
55
+ def find_digest(self, timestamp):
56
+ """Find the latest image before the given timestamp."""
57
+ index = bisect.bisect_right(self.timestamps, timestamp)
58
+ if index > 0:
59
+ return self.digests[index - 1]
60
+
61
+ logging.error('Failed to find suitable base-builder.')
62
+ return None
63
+
64
+
65
+ def _replace_gitdir(src_dir, file_path):
66
+ """Replace gitdir with a relative path."""
67
+ with open(file_path) as handle:
68
+ lines = handle.readlines()
69
+
70
+ new_lines = []
71
+ for line in lines:
72
+ if line.startswith(_GIT_DIR_MARKER):
73
+ absolute_path = line[len(_GIT_DIR_MARKER):].strip()
74
+ if not os.path.isabs(absolute_path):
75
+ # Already relative.
76
+ return
77
+
78
+ current_dir = os.path.dirname(file_path)
79
+ # Rebase to /src rather than the host src dir.
80
+ base_dir = current_dir.replace(src_dir, '/src')
81
+ relative_path = os.path.relpath(absolute_path, base_dir)
82
+ logging.info('Replacing absolute submodule gitdir from %s to %s',
83
+ absolute_path, relative_path)
84
+
85
+ line = _GIT_DIR_MARKER + relative_path
86
+
87
+ new_lines.append(line)
88
+
89
+ with open(file_path, 'w') as handle:
90
+ handle.write(''.join(new_lines))
91
+
92
+
93
+ def _make_gitdirs_relative(src_dir):
94
+ """Make gitdirs relative."""
95
+ for root_dir, _, files in os.walk(src_dir):
96
+ for filename in files:
97
+ if filename != '.git':
98
+ continue
99
+
100
+ file_path = os.path.join(root_dir, filename)
101
+ _replace_gitdir(src_dir, file_path)
102
+
103
+
104
+ def _replace_base_builder_digest(dockerfile_path, digest):
105
+ """Replace the base-builder digest in a Dockerfile."""
106
+ with open(dockerfile_path) as handle:
107
+ lines = handle.readlines()
108
+
109
+ new_lines = []
110
+ for line in lines:
111
+ if line.strip().startswith('FROM'):
112
+ line = 'FROM ghcr.io/aixcc-finals/base-builder@' + digest + '\n'
113
+
114
+ new_lines.append(line)
115
+
116
+ with open(dockerfile_path, 'w') as handle:
117
+ handle.write(''.join(new_lines))
118
+
119
+
120
+ def copy_src_from_docker(project_name, host_dir):
121
+ """Copy /src from docker to the host."""
122
+ # Copy /src to host.
123
+ image_name = 'gcr.io/oss-fuzz/' + project_name
124
+ src_dir = os.path.join(host_dir, 'src')
125
+ if os.path.exists(src_dir):
126
+ shutil.rmtree(src_dir, ignore_errors=True)
127
+
128
+ docker_args = [
129
+ '-v',
130
+ host_dir + ':/out',
131
+ image_name,
132
+ 'cp',
133
+ '-r',
134
+ '-p',
135
+ '/src',
136
+ '/out',
137
+ ]
138
+ helper.docker_run(docker_args)
139
+
140
+ # Submodules can have gitdir entries which point to absolute paths. Make them
141
+ # relative, as otherwise we can't do operations on the checkout on the host.
142
+ _make_gitdirs_relative(src_dir)
143
+ return src_dir
144
+
145
+
146
+ @retry.wrap(_IMAGE_BUILD_TRIES, 2)
147
+ def _build_image_with_retries(project_name):
148
+ """Build image with retries."""
149
+ return helper.build_image_impl(helper.Project(project_name))
150
+
151
+
152
+ def get_required_post_checkout_steps(dockerfile_path):
153
+ """Get required post checkout steps (best effort)."""
154
+
155
+ checkout_pattern = re.compile(r'\s*RUN\s*(git|svn|hg)')
156
+
157
+ # If the build.sh is copied from upstream, we need to copy it again after
158
+ # changing the revision to ensure correct building.
159
+ post_run_pattern = re.compile(r'\s*RUN\s*(.*build\.sh.*(\$SRC|/src).*)')
160
+
161
+ with open(dockerfile_path) as handle:
162
+ lines = handle.readlines()
163
+
164
+ subsequent_run_cmds = []
165
+ for i, line in enumerate(lines):
166
+ if checkout_pattern.match(line):
167
+ subsequent_run_cmds = []
168
+ continue
169
+
170
+ match = post_run_pattern.match(line)
171
+ if match:
172
+ workdir = helper.workdir_from_lines(lines[:i])
173
+ command = match.group(1)
174
+ subsequent_run_cmds.append((workdir, command))
175
+
176
+ return subsequent_run_cmds
177
+
178
+
179
+ # pylint: disable=too-many-locals
180
+ def build_fuzzers_from_commit(commit,
181
+ build_repo_manager,
182
+ host_src_path,
183
+ build_data,
184
+ base_builder_repo=None):
185
+ """Builds a OSS-Fuzz fuzzer at a specific commit SHA.
186
+
187
+ Args:
188
+ commit: The commit SHA to build the fuzzers at.
189
+ build_repo_manager: The OSS-Fuzz project's repo manager to be built at.
190
+ build_data: A struct containing project build information.
191
+ base_builder_repo: A BaseBuilderRepo.
192
+ Returns:
193
+ 0 on successful build or error code on failure.
194
+ """
195
+ oss_fuzz_repo_manager = repo_manager.RepoManager(helper.OSS_FUZZ_DIR)
196
+ num_retry = 1
197
+
198
+ def cleanup():
199
+ # Re-copy /src for a clean checkout every time.
200
+ copy_src_from_docker(build_data.project_name,
201
+ os.path.dirname(host_src_path))
202
+ build_repo_manager.fetch_all_remotes()
203
+
204
+ projects_dir = os.path.join('projects', build_data.project_name)
205
+ dockerfile_path = os.path.join(projects_dir, 'Dockerfile')
206
+
207
+ for i in range(num_retry + 1):
208
+ build_repo_manager.checkout_commit(commit, clean=False)
209
+
210
+ post_checkout_steps = get_required_post_checkout_steps(dockerfile_path)
211
+ for workdir, post_checkout_step in post_checkout_steps:
212
+ logging.info('Running post-checkout step `%s` in %s.', post_checkout_step,
213
+ workdir)
214
+ helper.docker_run([
215
+ '-w',
216
+ workdir,
217
+ '-v',
218
+ host_src_path + ':' + '/src',
219
+ 'gcr.io/oss-fuzz/' + build_data.project_name,
220
+ '/bin/bash',
221
+ '-c',
222
+ post_checkout_step,
223
+ ])
224
+
225
+ project = helper.Project(build_data.project_name)
226
+ result = helper.build_fuzzers_impl(project=project,
227
+ clean=True,
228
+ engine=build_data.engine,
229
+ sanitizer=build_data.sanitizer,
230
+ architecture=build_data.architecture,
231
+ env_to_add=None,
232
+ source_path=host_src_path,
233
+ mount_path='/src')
234
+ if result or i == num_retry:
235
+ break
236
+
237
+ # Retry with an OSS-Fuzz builder container that's closer to the project
238
+ # commit date.
239
+ commit_date = build_repo_manager.commit_date(commit)
240
+
241
+ # Find first change in the projects/<PROJECT> directory before the project
242
+ # commit date.
243
+ oss_fuzz_commit, _, _ = oss_fuzz_repo_manager.git([
244
+ 'log', '--before=' + commit_date.isoformat(), '-n1', '--format=%H',
245
+ projects_dir
246
+ ],
247
+ check_result=True)
248
+ oss_fuzz_commit = oss_fuzz_commit.strip()
249
+ if not oss_fuzz_commit:
250
+ logging.info(
251
+ 'Could not find first OSS-Fuzz commit prior to upstream commit. '
252
+ 'Falling back to oldest integration commit.')
253
+
254
+ # Find the oldest commit.
255
+ oss_fuzz_commit, _, _ = oss_fuzz_repo_manager.git(
256
+ ['log', '--reverse', '--format=%H', projects_dir], check_result=True)
257
+
258
+ oss_fuzz_commit = oss_fuzz_commit.splitlines()[0].strip()
259
+
260
+ if not oss_fuzz_commit:
261
+ logging.error('Failed to get oldest integration commit.')
262
+ break
263
+
264
+ logging.info('Build failed. Retrying on earlier OSS-Fuzz commit %s.',
265
+ oss_fuzz_commit)
266
+
267
+ # Check out projects/<PROJECT> dir to the commit that was found.
268
+ oss_fuzz_repo_manager.git(['checkout', oss_fuzz_commit, projects_dir],
269
+ check_result=True)
270
+
271
+ # Also use the closest base-builder we can find.
272
+ if base_builder_repo:
273
+ base_builder_digest = base_builder_repo.find_digest(commit_date)
274
+ if not base_builder_digest:
275
+ return False
276
+
277
+ logging.info('Using base-builder with digest %s.', base_builder_digest)
278
+ _replace_base_builder_digest(dockerfile_path, base_builder_digest)
279
+
280
+ # Rebuild image and re-copy src dir since things in /src could have changed.
281
+ if not _build_image_with_retries(build_data.project_name):
282
+ logging.error('Failed to rebuild image.')
283
+ return False
284
+
285
+ cleanup()
286
+
287
+ cleanup()
288
+ return result
289
+
290
+
291
+ def detect_main_repo(project_name, repo_name=None, commit=None):
292
+ """Checks a docker image for the main repo of an OSS-Fuzz project.
293
+
294
+ Note: The default is to use the repo name to detect the main repo.
295
+
296
+ Args:
297
+ project_name: The name of the oss-fuzz project.
298
+ repo_name: The name of the main repo in an OSS-Fuzz project.
299
+ commit: A commit SHA that is associated with the main repo.
300
+
301
+ Returns:
302
+ A tuple containing (the repo's origin, the repo's path).
303
+ """
304
+
305
+ if not repo_name and not commit:
306
+ logging.error(
307
+ 'Error: can not detect main repo without a repo_name or a commit.')
308
+ return None, None
309
+ if repo_name and commit:
310
+ logging.info(
311
+ 'Both repo name and commit specific. Using repo name for detection.')
312
+
313
+ # Change to oss-fuzz main directory so helper.py runs correctly.
314
+ utils.chdir_to_root()
315
+ if not _build_image_with_retries(project_name):
316
+ logging.error('Error: building %s image failed.', project_name)
317
+ return None, None
318
+ docker_image_name = 'gcr.io/oss-fuzz/' + project_name
319
+ command_to_run = [
320
+ 'docker', 'run', '--rm', '-t', docker_image_name, 'python3',
321
+ os.path.join('/opt', 'cifuzz', 'detect_repo.py')
322
+ ]
323
+ if repo_name:
324
+ command_to_run.extend(['--repo_name', repo_name])
325
+ else:
326
+ command_to_run.extend(['--example_commit', commit])
327
+ out, _, _ = utils.execute(command_to_run)
328
+ match = re.search(r'\bDetected repo: ([^ ]+) ([^ ]+)', out.rstrip())
329
+ if match and match.group(1) and match.group(2):
330
+ return match.group(1), match.group(2)
331
+
332
+ logging.error('Failed to detect repo:\n%s', out)
333
+ return None, None
334
+
335
+
336
+ def load_base_builder_repo():
337
+ """Get base-image digests."""
338
+ gcloud_path = shutil.which('gcloud')
339
+ if not gcloud_path:
340
+ logging.warning('gcloud not found in PATH.')
341
+ return None
342
+
343
+ result, _, _ = utils.execute([
344
+ gcloud_path,
345
+ 'container',
346
+ 'images',
347
+ 'list-tags',
348
+ 'ghcr.io/aixcc-finals/base-builder',
349
+ '--format=json',
350
+ '--sort-by=timestamp',
351
+ ],
352
+ check_result=True)
353
+ result = json.loads(result)
354
+
355
+ repo = BaseBuilderRepo()
356
+ for image in result:
357
+ timestamp = datetime.datetime.fromisoformat(
358
+ image['timestamp']['datetime']).astimezone(datetime.timezone.utc)
359
+ repo.add_digest(timestamp, image['digest'])
360
+
361
+ return repo
362
+
363
+
364
+ def main():
365
+ """Main function."""
366
+ logging.getLogger().setLevel(logging.INFO)
367
+
368
+ parser = argparse.ArgumentParser(
369
+ description='Build fuzzers at a specific commit')
370
+ parser.add_argument('--project_name',
371
+ help='The name of the project where the bug occurred.',
372
+ required=True)
373
+ parser.add_argument('--commit',
374
+ help='The newest commit SHA to be bisected.',
375
+ required=True)
376
+ parser.add_argument('--engine',
377
+ help='The default is "libfuzzer".',
378
+ default='libfuzzer')
379
+ parser.add_argument('--sanitizer',
380
+ default='address',
381
+ help='The default is "address".')
382
+ parser.add_argument('--architecture', default='x86_64')
383
+
384
+ args = parser.parse_args()
385
+
386
+ repo_url, repo_path = detect_main_repo(args.project_name, commit=args.commit)
387
+
388
+ if not repo_url or not repo_path:
389
+ raise ValueError('Main git repo can not be determined.')
390
+
391
+ with tempfile.TemporaryDirectory() as tmp_dir:
392
+ host_src_dir = copy_src_from_docker(args.project_name, tmp_dir)
393
+ build_repo_manager = repo_manager.RepoManager(
394
+ os.path.join(host_src_dir, os.path.basename(repo_path)))
395
+ base_builder_repo = load_base_builder_repo()
396
+
397
+ build_data = BuildData(project_name=args.project_name,
398
+ engine=args.engine,
399
+ sanitizer=args.sanitizer,
400
+ architecture=args.architecture)
401
+ if not build_fuzzers_from_commit(args.commit,
402
+ build_repo_manager,
403
+ host_src_dir,
404
+ build_data,
405
+ base_builder_repo=base_builder_repo):
406
+ raise RuntimeError('Failed to build.')
407
+
408
+
409
+ if __name__ == '__main__':
410
+ main()
local-test-curl-delta-01/fuzz-tooling/infra/build_specified_commit_test.py ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2019 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """Test the functionality of the build image from commit module.
15
+ The will consist of the following functional tests:
16
+ 1. The inference of the main repo for a specific project.
17
+ 2. The building of a projects fuzzers from a specific commit.
18
+
19
+ """
20
+ import os
21
+ import tempfile
22
+ import unittest
23
+
24
+ import build_specified_commit
25
+ import helper
26
+ import repo_manager
27
+ import test_repos
28
+
29
+ # necessary because __file__ changes with os.chdir
30
+ TEST_DIR_PATH = os.path.dirname(os.path.realpath(__file__))
31
+
32
+
33
+ @unittest.skipIf(not os.getenv('INTEGRATION_TESTS'),
34
+ 'INTEGRATION_TESTS=1 not set')
35
+ class BuildImageIntegrationTest(unittest.TestCase):
36
+ """Tests if an image can be built from different states e.g. a commit."""
37
+
38
+ @unittest.skip('Test is failing (spuriously?).')
39
+ def test_build_fuzzers_from_commit(self):
40
+ """Tests if the fuzzers can build at a specified commit.
41
+
42
+ This is done by using a known regression range for a specific test case.
43
+ The old commit should show the error when its fuzzers run and the new one
44
+ should not.
45
+ """
46
+ with tempfile.TemporaryDirectory() as tmp_dir:
47
+ test_repo = test_repos.TEST_REPOS[1]
48
+ self.assertTrue(helper.build_image_impl(test_repo.project_name))
49
+ host_src_dir = build_specified_commit.copy_src_from_docker(
50
+ test_repo.project_name, tmp_dir)
51
+
52
+ test_repo_manager = repo_manager.clone_repo_and_get_manager(
53
+ test_repo.git_url, host_src_dir, test_repo.oss_repo_name)
54
+ build_data = build_specified_commit.BuildData(
55
+ sanitizer='address',
56
+ architecture='x86_64',
57
+ engine='libfuzzer',
58
+ project_name=test_repo.project_name)
59
+
60
+ build_specified_commit.build_fuzzers_from_commit(test_repo.old_commit,
61
+ test_repo_manager,
62
+ host_src_dir, build_data)
63
+ project = helper.Project(test_repo.project_name)
64
+ old_result = helper.reproduce_impl(project=project,
65
+ fuzzer_name=test_repo.fuzz_target,
66
+ valgrind=False,
67
+ env_to_add=[],
68
+ fuzzer_args=[],
69
+ testcase_path=test_repo.testcase_path)
70
+ build_specified_commit.build_fuzzers_from_commit(test_repo.project_name,
71
+ test_repo_manager,
72
+ host_src_dir, build_data)
73
+ new_result = helper.reproduce_impl(project=project,
74
+ fuzzer_name=test_repo.fuzz_target,
75
+ valgrind=False,
76
+ env_to_add=[],
77
+ fuzzer_args=[],
78
+ testcase_path=test_repo.testcase_path)
79
+ self.assertNotEqual(new_result, old_result)
80
+
81
+ def test_detect_main_repo_from_commit(self):
82
+ """Test the detect main repo function from build specific commit module."""
83
+ # TODO(metzman): Fix these tests so they don't randomly break because of
84
+ # changes in the outside world.
85
+ for example_repo in test_repos.TEST_REPOS:
86
+ if example_repo.new_commit:
87
+ # TODO(metzman): This function calls _build_image_with_retries which
88
+ # has a long delay (30 seconds). Figure out how to make this quicker.
89
+ repo_origin, repo_name = build_specified_commit.detect_main_repo(
90
+ example_repo.project_name, commit=example_repo.new_commit)
91
+ self.assertEqual(repo_origin, example_repo.git_url)
92
+ self.assertEqual(repo_name,
93
+ os.path.join('/src', example_repo.oss_repo_name))
94
+
95
+ repo_origin, repo_name = build_specified_commit.detect_main_repo(
96
+ test_repos.INVALID_REPO.project_name,
97
+ test_repos.INVALID_REPO.new_commit)
98
+ self.assertIsNone(repo_origin)
99
+ self.assertIsNone(repo_name)
100
+
101
+ def test_detect_main_repo_from_name(self):
102
+ """Test the detect main repo function from build specific commit module."""
103
+ for example_repo in test_repos.TEST_REPOS:
104
+ if example_repo.project_name == 'gonids':
105
+ # It's unclear how this test ever passed, but we can't infer the repo
106
+ # because gonids doesn't really check it out, it uses "go get".
107
+ continue
108
+ repo_origin, repo_name = build_specified_commit.detect_main_repo(
109
+ example_repo.project_name, repo_name=example_repo.git_repo_name)
110
+ self.assertEqual(repo_origin, example_repo.git_url)
111
+ self.assertEqual(
112
+ repo_name,
113
+ os.path.join(example_repo.image_location, example_repo.oss_repo_name))
114
+
115
+ repo_origin, repo_name = build_specified_commit.detect_main_repo(
116
+ test_repos.INVALID_REPO.project_name,
117
+ test_repos.INVALID_REPO.oss_repo_name)
118
+ self.assertIsNone(repo_origin)
119
+ self.assertIsNone(repo_name)
120
+
121
+
122
+ if __name__ == '__main__':
123
+ # Change to oss-fuzz main directory so helper.py runs correctly.
124
+ if os.getcwd() != os.path.dirname(TEST_DIR_PATH):
125
+ os.chdir(os.path.dirname(TEST_DIR_PATH))
126
+ unittest.main()
local-test-curl-delta-01/fuzz-tooling/infra/ci/requirements.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # Requirements for submitting code changes to infra/ (needed by presubmit.py).
2
+ parameterized==0.7.4
3
+ pyfakefs==4.5.6
4
+ pylint==2.5.3
5
+ pytest==7.1.2
6
+ pytest-xdist==2.5.0
7
+ PyYAML==6.0
8
+ requests==2.31.0
9
+ yapf==0.32.0