aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLulu <lulu.berlin.2023@gmail.com>2024-10-08 01:41:41 +0000
committerGerrit Code Review <gerrit@localhost>2024-10-08 01:41:41 +0000
commit299813f324c9562b0bd6d0bc5d2114776e193d86 (patch)
treee33dfe4834e04c8f996aac0e859422ffb5b3a70d /tests
parentd6e1b11d3e91abc4194744310f36e37a57dd6e1d (diff)
parent51a5025913cd2c901203e1a8d8f8a0df1c1a130b (diff)
Merge "Avoid calling memcpy when len == 0 in filetransfer.cc" into main
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/libstore/filetransfer.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/unit/libstore/filetransfer.cc b/tests/unit/libstore/filetransfer.cc
index 71e7392fc..fd4d326f0 100644
--- a/tests/unit/libstore/filetransfer.cc
+++ b/tests/unit/libstore/filetransfer.cc
@@ -150,6 +150,14 @@ TEST(FileTransfer, exceptionAbortsDownload)
}
}
+TEST(FileTransfer, exceptionAbortsRead)
+{
+ auto [port, srv] = serveHTTP("200 ok", "content-length: 0\r\n", [] { return ""; });
+ auto ft = makeFileTransfer();
+ char buf[10] = "";
+ ASSERT_THROW(ft->download(FileTransferRequest(fmt("http://[::1]:%d/index", port)))->read(buf, 10), EndOfFile);
+}
+
TEST(FileTransfer, NOT_ON_DARWIN(reportsSetupErrors))
{
auto [port, srv] = serveHTTP("404 not found", "", [] { return ""; });