void-linux / void-packages

The Void source packages collection
https://voidlinux.org
Other
2.59k stars 2.16k forks source link

xbps-src update-check: curl does not decompress responses #29429

Closed unspecd closed 2 years ago

unspecd commented 3 years ago

Steps to reproduce the behavior

$ ./xbps-src update-check llvm11
NO VERSION found for llvm11
$ curl https://releases.llvm.org
Warning: Binary output can mess up your terminal. Use "--output -" to tell 
Warning: curl to output it to your terminal anyway, or consider "--output 
Warning: <FILE>" to save to a file.
$ curl -sI https://releases.llvm.org | grep encoding
content-encoding: gzip

Possible solution

File: common/xbps-src/shutils/update_check.sh.

@@ -85,7 +85,7 @@ update_check() {
                 echo "(folder) fetching $urlpfx" 1>&2
             fi
             skipdirs=
-            curl -A "xbps-src-update-check/$XBPS_SRC_VERSION" --max-time 10 -Lsk "$urlpfx" |
+            curl --compressed -A "xbps-src-update-check/$XBPS_SRC_VERSION" --max-time 10 -Lsk "$urlpfx" |
                 grep -Po -i "$rx" |
                 # sort -V places 1.1/ before 1/, but 1A/ before 1.1A/
                 sed -e 's:$:A:' -e 's:/A$:A/:' | sort -Vru | sed -e 's:A/$:/A:' -e 's:A$::' |
@@ -171,7 +171,7 @@ update_check() {
         if [ -n "$XBPS_UPDATE_CHECK_VERBOSE" ]; then
             echo "fetching $url" 1>&2
         fi
-        curl -H 'Accept: text/html,application/xhtml+xml,application/xml,text/plain,application/rss+xml' -A "xbps-src-update-check/$XBPS_SRC_VERSION" --max-time 10 -Lsk "$url" |
+        curl --compressed -H 'Accept: text/html,application/xhtml+xml,application/xml,text/plain,application/rss+xml' -A "xbps-src-update-check/$XBPS_SRC_VERSION" --max-time 10 -Lsk "$url" |
             grep -Po -i "$rx"
         fetchedurls[$url]=yes
     done |
ericonr commented 3 years ago

Could you please PR this? Makes for easier discussion.

unspecd commented 3 years ago

@ericonr, the PR is here: #30590.

Johnnynator commented 3 years ago

This looks to me like the llvm webserver is misbehaving, and sending always gzip encoded responses, even if gzip is not even in the Accept-encoding header.

github-actions[bot] commented 2 years ago

Issues become stale 90 days after last activity and are closed 14 days after that. If this issue is still relevant bump it or assign it.