gpt4 book ai didi

c++ - libcurl 中是否有可用的压缩

转载 作者:行者123 更新时间:2023-11-30 04:23:25 25 4
gpt4 key购买 nike

我需要使用带有 C++ 的 libcurl 将一个巨大的文件从本地机器传输到远程机器。 libcurl 是否内置了任何可用的压缩选项。由于要传输的数据很大(大小为 100 MB 到 1 GB),如果我们在 libcurl 本身中提供任何此类选项会更好。我知道我们可以压缩数据并通过 libcurl 发送。但只是想知道是否有更好的方法。

注意:在我的例子中,许多客户端机器定期将如此庞大的数据传输到远程服务器。

谢谢,帕布

最佳答案

根据 curl_setopt()和选项 CURLOPT_ENCODING,您可以指定:

The contents of the "Accept-Encoding: " header. This enables decoding of the response. Supported encodings are "identity", "deflate", and "gzip". If an empty string, "", is set, a header containing all supported encoding types is sent.

Here是一些示例(只需在您的浏览器中点击搜索并输入 compression),但我不知道 hot 到底是否有效以及它是否需要已经 gzip 的数据。

您仍然可以使用 gzcompress()并自行发送压缩 block (我将以这种方式完成任务……您将更好地控制实际发生的事情,并且您将能够更改使用的算法)。

关于c++ - libcurl 中是否有可用的压缩,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13379888/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com