diff --git a/libs/config b/libs/config index ece3d0f7..cf72ef80 160000 --- a/libs/config +++ b/libs/config @@ -1 +1 @@ -Subproject commit ece3d0f792fc4447676bc2a34f38001ef883886a +Subproject commit cf72ef808375d78fd21b5bd2a008f4f590a228d1 diff --git a/libs/document b/libs/document index 94c60ad6..3f78d0b2 160000 --- a/libs/document +++ b/libs/document @@ -1 +1 @@ -Subproject commit 94c60ad623f12b000d710fc8b07484a00c44dc46 +Subproject commit 3f78d0b2b6b107d37e916949386a4ed4c8dd5554 diff --git a/libs/idna b/libs/idna index f298a3e5..2250caa6 160000 --- a/libs/idna +++ b/libs/idna @@ -1 +1 @@ -Subproject commit f298a3e5bb69ca5bcab9d83a5f661bba79fdc37b +Subproject commit 2250caa64c0fef64971e256d3ea39239aeffbee3 diff --git a/libs/lexical b/libs/lexical index f9d25ff8..1a0556da 160000 --- a/libs/lexical +++ b/libs/lexical @@ -1 +1 @@ -Subproject commit f9d25ff8f6fe844a613ca0953a9bb9a4205aade0 +Subproject commit 1a0556da6a43f8a1864a368c76d418e09714efa5 diff --git a/libs/pratt b/libs/pratt index 37595b11..c46eb1b8 160000 --- a/libs/pratt +++ b/libs/pratt @@ -1 +1 @@ -Subproject commit 37595b111ce42364124e50f0c7920f3b1ab1b31f +Subproject commit c46eb1b86de2013b9efacfef6ab12982c6875b6a diff --git a/libs/trystero b/libs/trystero index 10c88665..a9af9325 160000 --- a/libs/trystero +++ b/libs/trystero @@ -1 +1 @@ -Subproject commit 10c8866513e0fe6f2266cd3d18ed38861f7c9354 +Subproject commit a9af9325695e64994c9e5fbb14a4abcbd328b616 diff --git a/libs/wasi b/libs/wasi index b936324d..983119bd 160000 --- a/libs/wasi +++ b/libs/wasi @@ -1 +1 @@ -Subproject commit b936324dc4c2c1adeecdceedaa3dd17155e2b1cb +Subproject commit 983119bde46a6d20235eaca8c03fe9631f019d18 diff --git a/libs/xactor b/libs/xactor index 71013bf0..611b6ccb 160000 --- a/libs/xactor +++ b/libs/xactor @@ -1 +1 @@ -Subproject commit 71013bf0afb2facfb03f1b64cd023d25f5e436fc +Subproject commit 611b6ccbdcbdad996ebddc26387c47550c2231fc diff --git a/libs/xstate b/libs/xstate index 03c4c85f..5e1b58c1 160000 --- a/libs/xstate +++ b/libs/xstate @@ -1 +1 @@ -Subproject commit 03c4c85f178fe4bcb2d3532d4d1dc4ecd9ea0dbc +Subproject commit 5e1b58c1334a17cdfb6df88db40e78fe50789012 diff --git a/site b/site index f1b4832a..d3aa48d2 160000 --- a/site +++ b/site @@ -1 +1 @@ -Subproject commit f1b4832adc6bf83a928c635b3417680986554d1f +Subproject commit d3aa48d20dbccfde4123fa58f7072dbdbab40ba0 diff --git a/tools/ci/actions_test.py b/tools/ci/actions_test.py index 8883ee14..6d888814 100755 --- a/tools/ci/actions_test.py +++ b/tools/ci/actions_test.py @@ -6,7 +6,8 @@ # https://www.boost.org/LICENSE_1_0.txt) """Checks the shell steps of tools/ci/actions: download.sh keeps a file only when its SHA-256 is -the pinned one, exits 1 and leaves no file when the digest differs or the download fails; and the +the pinned one, tries again a connection the server drops, exits 1 and leaves no file when the +digest differs or the download fails; and the Boost action's install.sh refuses an empty or relative prefix before it downloads anything, since b2 given an empty --prefix installs into /usr/local, installs b2 in /bin and the headers in /include/boost on every runner, Windows's included, where the default layouts would put @@ -45,7 +46,8 @@ is not OpenSSL 3; and each refuses a runner it builds nothing for. The node action keys npm's cache on the lock file of every directory a job runs npm ci in: tools/doc, tools/lint, every library's oracle and the site. Nothing is fetched -from the network: the downloads are file:// URLs, git is a stand-in, and install.sh runs against +from the network: the downloads are file:// URLs or a server of the test's own on the loopback, git +is a stand-in, and install.sh runs against a download.sh that only says it was called, or that hands it a stand-in archive. Run with the names of some cases to run only those.""" @@ -56,10 +58,12 @@ import os import re import shutil +import socket import subprocess import sys import tarfile import tempfile +import threading import zipfile from collections.abc import Callable from pathlib import Path @@ -118,6 +122,54 @@ def test_a_failed_download_exits_1_and_leaves_no_file(scratch: Path) -> None: assert not file.exists() +class DroppingServer: + """An HTTP server on the loopback whose first connection closes with no reply, as a server + that drops a TLS handshake does, and which serves `body` on every later one.""" + + def __init__(self, body: bytes) -> None: + self.body = body + self.connections = 0 + self.listener = socket.create_server(('127.0.0.1', 0)) + self.thread = threading.Thread(target=self.serve, daemon=True) + self.thread.start() + + @property + def url(self) -> str: + return f'http://127.0.0.1:{self.listener.getsockname()[1]}/archive.tar.gz' + + def serve(self) -> None: + while True: + try: + connection, _ = self.listener.accept() + except OSError: + return + with connection: + self.connections += 1 + if self.connections == 1: + continue + connection.recv(65536) + head = f'HTTP/1.1 200 OK\r\nContent-Length: {len(self.body)}\r\n' + connection.sendall(f'{head}Connection: close\r\n\r\n'.encode() + self.body) + + def close(self) -> None: + self.listener.close() + self.thread.join(timeout=5) + + +def test_a_dropped_connection_is_tried_again(scratch: Path) -> None: + path, digest = source(scratch) + server = DroppingServer(path.read_bytes()) + file = scratch / 'downloaded' + try: + result = run(DOWNLOAD, server.url, digest, file, + env={'no_proxy': '127.0.0.1', 'NO_PROXY': '127.0.0.1'}) + finally: + server.close() + assert result.returncode == 0, (result.returncode, result.stderr) + assert server.connections == 2, server.connections + assert file.read_bytes() == path.read_bytes() + + def test_a_usage_error_exits_2(scratch: Path) -> None: result = run(DOWNLOAD, 'file:///nothing') assert result.returncode == 2, (result.returncode, result.stderr) @@ -1714,6 +1766,7 @@ def helper(call: str, **variables: str) -> str: test_a_pinned_download_is_kept, test_another_digest_leaves_no_file, test_a_failed_download_exits_1_and_leaves_no_file, + test_a_dropped_connection_is_tried_again, test_a_usage_error_exits_2, test_boost_refuses_an_empty_or_relative_prefix, test_boost_installs_b2_and_the_headers_where_configure_finds_them, diff --git a/tools/ci/download.sh b/tools/ci/download.sh index 81cf6363..802befe6 100755 --- a/tools/ci/download.sh +++ b/tools/ci/download.sh @@ -20,8 +20,11 @@ url="$1" expected="$2" file="$3" -# A failed download can leave part of the file, which must not be taken for the whole. -curl -fsSL --retry 3 -o "${file}" "${url}" || { +# A failed download can leave part of the file, which must not be taken for the whole. curl's +# --retry alone tries again only a timeout and an HTTP 408, 429 or 5xx; --retry-all-errors also +# tries again a connection the server drops, as a TLS handshake cut short does (curl's exit +# statuses 35, 52 and 56), which failed CI lanes downloading Boost. +curl -fsSL --retry 3 --retry-all-errors -o "${file}" "${url}" || { status=$? rm -f "${file}" printf 'download.sh: could not download %s (curl exit status %s)\n' "${url}" "${status}" >&2