On Mon, 21 May 2018, Jonathan Nieder wrote:
Looking at the code here, this succeeds if enough memory is available.
There is no check if the given parameter is part of
Curl_all_content_encodings();
By "this" are you referring to the preimage or the postimage? Are you
suggesting a change in git or in libcurl?
Curl_all_content_encodings() is an internal function in libcurl, so I'm
assuming the latter.
Ack, that certainly isn't the most wonderful API for selecting a compression
method. In reality, almost everyone sticks to passing on a "" to that option
to let libcurl pick and ask for the compression algos it knows since both gzip
and brotli are present only conditionally depending on build options.
I would agree that the libcurl setopt call should probably be made to fail if
asked to use a compression method not built-in/supported. Then an application
could in fact try different algos in order until one works or ask to disable
compression completely.
In the generic HTTP case, it usually makes sense to ask for more than one
algorthim though, since this is asking the server for a compressed version and
typically a HTTP client doesn't know which compression methods the server
offers. Not sure this is actually true to the same extent for git.
--
/ daniel.haxx.se