Skip to content

Commit 6ca5600

Browse files
committed
Revert "Revert libcurl. (microsoft#1856)"
This reverts commit da1f056.
1 parent da1f056 commit 6ca5600

File tree

28 files changed

+922
-1400
lines changed

28 files changed

+922
-1400
lines changed

.github/workflows/build.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ jobs:
3636
uses: github/codeql-action/init@v3
3737
with:
3838
languages: javascript-typescript, c-cpp
39+
- name: Install system libcurl
40+
if: matrix.preset == 'linux-arm64-ci' || matrix.preset == 'linux-ci'
41+
run: |
42+
sudo apt update
43+
sudo apt install -y libcurl4-openssl-dev
3944
- name: Configure and Build
4045
if: matrix.preset != 'windows-ci'
4146
run: |

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ set(TEST_SCRIPT_ASSET_CACHE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/test-script
195195

196196
find_package(fmt REQUIRED)
197197
find_package(CMakeRC REQUIRED)
198+
find_package(LibCURL REQUIRED)
198199

199200
# === Target: locale-resources ===
200201

@@ -229,6 +230,8 @@ target_compile_definitions(vcpkglib PUBLIC
229230
_FILE_OFFSET_BITS=64
230231
)
231232

233+
target_link_libraries(vcpkglib PUBLIC CURL::libcurl)
234+
232235
if(VCPKG_STANDALONE_BUNDLE_SHA)
233236
target_compile_definitions(vcpkglib PUBLIC
234237
"VCPKG_STANDALONE_BUNDLE_SHA=${VCPKG_STANDALONE_BUNDLE_SHA}"

NOTICE.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,35 @@ SOFTWARE.
7171
=========================================
7272
END OF CMakeRC NOTICES, INFORMATION, AND LICENSE
7373

74+
curl
75+
76+
%% curl NOTICES, INFORMATION, AND LICENSE BEGIN HERE
77+
=========================================
78+
COPYRIGHT AND PERMISSION NOTICE
79+
80+
Copyright (C) Daniel Stenberg, <[email protected]>, and many
81+
contributors, see the THANKS file.
82+
83+
All rights reserved.
84+
85+
Permission to use, copy, modify, and distribute this software for any purpose
86+
with or without fee is hereby granted, provided that the above copyright
87+
notice and this permission notice appear in all copies.
88+
89+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
90+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
91+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
92+
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
93+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
94+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
95+
OR OTHER DEALINGS IN THE SOFTWARE.
96+
97+
Except as contained in this notice, the name of a copyright holder shall not
98+
be used in advertising or otherwise to promote the sale, use or other dealings
99+
in this Software without prior written authorization of the copyright holder.
100+
=========================================
101+
END OF curl NOTICES, INFORMATION, AND LICENSE
102+
74103
The following third party software is incorporated into vcpkg-artifacts:
75104

76105
---------------------------------------------------------

azure-pipelines/end-to-end-tests-dir/asset-caching.ps1

Lines changed: 23 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ Throw-IfNotFailed
5959
$expected = @(
6060
"A suitable version of cmake was not found \(required v[0-9.]+\)\.",
6161
"Trying to download cmake-[0-9.]+-[^.]+\.(zip|tar\.gz) using asset cache file://$assetCacheRegex/[0-9a-z]+",
62-
"error: curl: \(37\) Couldn't open file [^\n]+",
62+
"error: curl operation failed with error code 37 \((Couldn't|Could not) read a file:\/\/ file\)\.",
63+
"error: Not a transient network error, won't retry download from file://$assetCacheRegex/[0-9a-z]+"
6364
"error: there were no asset cache hits, and x-block-origin blocks trying the authoritative source https://github\.com/Kitware/CMake/releases/download/[^ ]+",
6465
"note: If you are using a proxy, please ensure your proxy settings are correct\.",
6566
"Possible causes are:",
@@ -111,7 +112,8 @@ if (-not ($actual -match $expected)) {
111112
Refresh-TestRoot
112113
$expected = @(
113114
"^Downloading https://localhost:1234/foobar\.html -> example3\.html",
114-
"error: curl: \(7\) Failed to connect to localhost port 1234( after \d+ ms)?: ((Could not|Couldn't) connect to server|Connection refused)",
115+
"error: curl operation failed with error code 7 \((Couldn't|Could not) connect to server\)\.",
116+
"error: Not a transient network error, won't retry download from https://localhost:1234/foobar\.html",
115117
"note: If you are using a proxy, please ensure your proxy settings are correct\.",
116118
"Possible causes are:",
117119
"1\. You are actually using an HTTP proxy, but setting HTTPS_PROXY variable to ``https://address:port``\.",
@@ -134,9 +136,11 @@ if (-not ($actual -match $expected)) {
134136
Refresh-TestRoot
135137
$expected = @(
136138
"^Downloading example3\.html, trying https://localhost:1234/foobar\.html",
139+
"error: curl operation failed with error code 7 \((Couldn't|Could not) connect to server\)\.",
140+
"error: Not a transient network error, won't retry download from https://localhost:1234/foobar\.html",
137141
"Trying https://localhost:1235/baz\.html",
138-
"error: curl: \(7\) Failed to connect to localhost port 1234( after \d+ ms)?: ((Could not|Couldn't) connect to server|Connection refused)",
139-
"error: curl: \(7\) Failed to connect to localhost port 1235( after \d+ ms)?: ((Could not|Couldn't) connect to server|Connection refused)",
142+
"error: curl operation failed with error code 7 \((Couldn't|Could not) connect to server\)\.",
143+
"error: Not a transient network error, won't retry download from https://localhost:1235/baz\.html",
140144
"note: If you are using a proxy, please ensure your proxy settings are correct\.",
141145
"Possible causes are:",
142146
"1\. You are actually using an HTTP proxy, but setting HTTPS_PROXY variable to ``https://address:port``\.",
@@ -188,42 +192,20 @@ if (-not ($actual -match $expected)) {
188192
}
189193

190194
# ... also with multiple authoritative URLs
191-
if ($IsWindows) {
192-
# WinHTTP
193-
Refresh-TestRoot
194-
$expected = @(
195-
"^Downloading example3\.html, trying https://nonexistent\.example\.com",
196-
"warning: Download https://nonexistent\.example\.com failed -- retrying after 1000ms",
197-
"warning: Download https://nonexistent\.example\.com failed -- retrying after 2000ms",
198-
"warning: Download https://nonexistent\.example\.com failed -- retrying after 4000ms",
199-
"Trying https://raw\.githubusercontent\.com/microsoft/vcpkg-tool/1767aaee7b229c609f7ad5cf2f57b6a6cc309fb8/LICENSE\.txt",
200-
"Successfully downloaded example3\.html",
201-
"$"
202-
) -join "`n"
203-
204-
$actual = Run-VcpkgAndCaptureOutput @commonArgs x-download "$TestDownloadsRoot/example3.html" --sha512 65077997890f66f6041bb3284bb7b88e27631411ccbc253201ca4e00c4bcc58c0d77edffda4975498797cc10772c7fd68fbeb13cc4ac493a3471a9d49e5b6f24 --url https://nonexistent.example.com --url https://raw.githubusercontent.com/microsoft/vcpkg-tool/1767aaee7b229c609f7ad5cf2f57b6a6cc309fb8/LICENSE.txt
205-
Throw-IfFailed
206-
if (-not ($actual -match $expected)) {
207-
throw "Failure: azurl (no), x-block-origin (no), asset-cache (n/a), download (succeed)"
208-
}
209-
}
210-
211-
# Force curl with --header
212195
Refresh-TestRoot
213196
$expected = @(
214197
"^Downloading example3\.html, trying https://nonexistent\.example\.com",
215-
"warning: (Problem : timeout\.|Transient problem: timeout) Will retry in 1 seconds?\. 3 retries left\.",
216-
"warning: (Problem : timeout\.|Transient problem: timeout) Will retry in \d+ seconds?\. 2 retries left\.",
217-
"warning: (Problem : timeout\.|Transient problem: timeout) Will retry in \d+ seconds?\. 1 (retries|retry) left\.",
218-
"Trying https://raw\.githubusercontent\.com/microsoft/vcpkg-tool/1767aaee7b229c609f7ad5cf2f57b6a6cc309fb8/LICENSE\.txt",
198+
"error: curl operation failed with error code 6 \((Couldn't|Could not) resolve (hostname|host name)\)\.",
199+
"error: Not a transient network error, won't retry download from https://nonexistent\.example\.com",
200+
"Trying https://raw\.githubusercontent\.com/microsoft/vcpkg-tool/1767aaee7b229c609f7ad5cf2f57b6a6cc309fb8/LICENSE\.txt"
219201
"Successfully downloaded example3\.html",
220202
"$"
221203
) -join "`n"
222204

223205
$actual = Run-VcpkgAndCaptureOutput @commonArgs x-download "$TestDownloadsRoot/example3.html" --sha512 65077997890f66f6041bb3284bb7b88e27631411ccbc253201ca4e00c4bcc58c0d77edffda4975498797cc10772c7fd68fbeb13cc4ac493a3471a9d49e5b6f24 --url https://nonexistent.example.com --url https://raw.githubusercontent.com/microsoft/vcpkg-tool/1767aaee7b229c609f7ad5cf2f57b6a6cc309fb8/LICENSE.txt --header "Cache-Control: no-cache"
224206
Throw-IfFailed
225207
if (-not ($actual -match $expected)) {
226-
throw "Failure: azurl (no), x-block-origin (no), asset-cache (n/a), download (succeed)"
208+
throw "Failure: azurl (no), x-block-origin (no), asset-cache (n/a), download (succeed), headers (cache-control)"
227209
}
228210

229211
# azurl (no), x-block-origin (yes), asset-cache (n/a), download (n/a)
@@ -247,8 +229,10 @@ Refresh-TestRoot
247229
$expected = @(
248230
"^Trying to download example3\.html using asset cache file://$assetCacheRegex/[0-9a-z]+",
249231
"Asset cache miss; trying authoritative source https://localhost:1234/foobar\.html",
250-
"error: curl: \(37\) Couldn't open file [^\n]+",
251-
"error: curl: \(7\) Failed to connect to localhost port 1234( after \d+ ms)?: ((Could not|Couldn't) connect to server|Connection refused)",
232+
"error: curl operation failed with error code 37 \((Couldn't|Could not) read a file:// file\)\.",
233+
"error: Not a transient network error, won't retry download from file://$assetCacheRegex/[0-9a-z]+",
234+
"error: curl operation failed with error code 7 \((Couldn't|Could not) connect to server\)\.",
235+
"error: Not a transient network error, won't retry download from https://localhost:1234/foobar\.html",
252236
"note: If you are using a proxy, please ensure your proxy settings are correct\.",
253237
"Possible causes are:",
254238
"1\. You are actually using an HTTP proxy, but setting HTTPS_PROXY variable to ``https://address:port``\.",
@@ -307,7 +291,11 @@ if (-not ($actual -match $expected)) {
307291
$expected = @(
308292
"^Trying to download example3\.html using asset cache file://$assetCacheRegex/[0-9a-z]+",
309293
"Asset cache miss; trying authoritative source https://raw\.githubusercontent\.com/microsoft/vcpkg-tool/1767aaee7b229c609f7ad5cf2f57b6a6cc309fb8/LICENSE\.txt",
310-
"error: curl: \(37\) Couldn't open file [^\n]+",
294+
"error: curl operation failed with error code 37 \((Couldn't|Could not) read a file:// file\)\.",
295+
"error: Not a transient network error, won't retry download from file://$assetCacheRegex/[0-9a-z]+",
296+
"[^\n]+example3\.html\.\d+\.part: error: download from https://raw\.githubusercontent\.com/microsoft/vcpkg-tool/1767aaee7b229c609f7ad5cf2f57b6a6cc309fb8/LICENSE\.txt had an unexpected hash",
297+
"note: Expected: d06b93c883f8126a04589937a884032df031b05518eed9d433efb6447834df2596aebd500d69b8283e5702d988ed49655ae654c1683c7a4ae58bfa6b92f2b73b",
298+
"note: Actual : 65077997890f66f6041bb3284bb7b88e27631411ccbc253201ca4e00c4bcc58c0d77edffda4975498797cc10772c7fd68fbeb13cc4ac493a3471a9d49e5b6f24",
311299
"note: If you are using a proxy, please ensure your proxy settings are correct\.",
312300
"Possible causes are:",
313301
"1\. You are actually using an HTTP proxy, but setting HTTPS_PROXY variable to ``https://address:port``\.",
@@ -317,9 +305,6 @@ $expected = @(
317305
"The value set by your proxy might be wrong, or have same ``https://`` prefix issue\.",
318306
"3\. Your proxy's remote server is out of service\.",
319307
"If you believe this is not a temporary download server failure and vcpkg needs to be changed to download this file from a different location, please submit an issue to https://github\.com/Microsoft/vcpkg/issues",
320-
"[^\n]+example3\.html\.\d+\.part: error: download from https://raw\.githubusercontent\.com/microsoft/vcpkg-tool/1767aaee7b229c609f7ad5cf2f57b6a6cc309fb8/LICENSE\.txt had an unexpected hash",
321-
"note: Expected: d06b93c883f8126a04589937a884032df031b05518eed9d433efb6447834df2596aebd500d69b8283e5702d988ed49655ae654c1683c7a4ae58bfa6b92f2b73b",
322-
"note: Actual : 65077997890f66f6041bb3284bb7b88e27631411ccbc253201ca4e00c4bcc58c0d77edffda4975498797cc10772c7fd68fbeb13cc4ac493a3471a9d49e5b6f24",
323308
"$"
324309
) -join "`n"
325310
$actual = Run-VcpkgAndCaptureOutput @commonArgs x-download "$TestDownloadsRoot/example3.html" --sha512 d06b93c883f8126a04589937a884032df031b05518eed9d433efb6447834df2596aebd500d69b8283e5702d988ed49655ae654c1683c7a4ae58bfa6b92f2b73b --url https://raw.githubusercontent.com/microsoft/vcpkg-tool/1767aaee7b229c609f7ad5cf2f57b6a6cc309fb8/LICENSE.txt "--x-asset-sources=x-azurl,file://$AssetCache,,readwrite"
@@ -369,7 +354,8 @@ if (-not ($actual -match $expected)) {
369354
Refresh-TestRoot
370355
$expected = @(
371356
"^Trying to download example3\.html using asset cache file://$assetCacheRegex/[0-9a-z]+",
372-
"error: curl: \(37\) Couldn't open file [^\n]+",
357+
"error: curl operation failed with error code 37 \((Couldn't|Could not) read a file:// file\)\.",
358+
"error: Not a transient network error, won't retry download from file://$assetCacheRegex/[0-9a-z]+",
373359
"error: there were no asset cache hits, and x-block-origin blocks trying the authoritative source https://raw\.githubusercontent\.com/microsoft/vcpkg-tool/1767aaee7b229c609f7ad5cf2f57b6a6cc309fb8/LICENSE\.txt",
374360
"note: or https://alternate\.example\.com",
375361
"note: If you are using a proxy, please ensure your proxy settings are correct\.",

0 commit comments

Comments
 (0)