18 "Whether to enable HTTP/2 support."};
21 "String appended to the user agent in HTTP requests."};
24 this, 25,
"http-connections",
26 The maximum number of parallel TCP connections used to fetch
27 files from binary caches and by other downloads. It defaults
28 to 25. 0 means no limit.
30 {"binary-caches-parallel-connections"}};
33 this, 0,
"connect-timeout",
35 The timeout (in seconds) for establishing connections in the
36 binary cache substituter. It corresponds to `curl`’s
37 `--connect-timeout` option. A value of 0 means no limit.
41 this, 300,
"stalled-download-timeout",
43 The timeout (in seconds) for receiving data from servers
44 during download. Nix cancels idle downloads after this
49 "How often Nix will attempt to download a file before giving up."};
51 Setting<size_t> downloadBufferSize{
this, 64 * 1024 * 1024,
"download-buffer-size",
53 The size of Nix's internal download buffer in bytes during `curl` transfers. If data is
54 not processed quickly enough to exceed the size of this buffer, downloads may stall.
55 The default is 67108864 (64 MiB).
61struct FileTransferRequest
65 std::string expectedETag;
66 bool verifyTLS =
true;
68 size_t tries = fileTransferSettings.tries;
69 unsigned int baseRetryTimeMs = 250;
71 bool decompress =
true;
72 std::optional<std::string> data;
74 std::function<void(std::string_view data)> dataCallback;
76 FileTransferRequest(std::string_view uri)
77 : uri(uri), parentAct(getCurActivity()) { }
81 return data ?
"upload" :
"download";
108 uint64_t bodySize = 0;
153 enum Error { NotFound, Forbidden, Misc, Transient, Interrupted };
171class FileTransferError :
public Error
174 FileTransfer::Error error;
178 template<
typename...
Args>
179 FileTransferError(FileTransfer::Error error, std::optional<std::string>
response,
const Args & ...
args);
Definition callback.hh:17
std::optional< std::string > response
intentionally optional
Definition filetransfer.hh:176
Definition store-api.hh:169
std::vector< Expr * > args
Definition lexer.l:6126
Definition filetransfer.hh:62
Definition filetransfer.hh:86
std::string data
Definition filetransfer.hh:106
std::vector< std::string > urls
Definition filetransfer.hh:101
bool cached
Definition filetransfer.hh:91
std::optional< std::string > immutableUrl
Definition filetransfer.hh:115
std::string etag
Definition filetransfer.hh:96
Definition filetransfer.hh:16
Definition filetransfer.hh:121
FileTransferResult download(const FileTransferRequest &request)
Definition filetransfer.cc:831
virtual void enqueueFileTransfer(const FileTransferRequest &request, Callback< FileTransferResult > callback)=0
FileTransferResult upload(const FileTransferRequest &request)
Definition filetransfer.cc:836
Definition serialise.hh:20