All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>
Subject: [PULL 4/6] tests/functional: add Accept header when downloading assets
Date: Mon, 23 Nov 2026 17:00:48 +0000	[thread overview]
Message-ID: <20261123170050.4166517-5-berrange@redhat.com> (raw)
In-Reply-To: <20261123170050.4166517-1-berrange@redhat.com>

elinux.org is currently triggering an Anubis challenge for requests
to download assets. After comparing the headers that curl sends, it
was narrowed down to the omission of an "Accept" header.

A missing "Accept" header is a rule that Anubis added a year ago
which is known to hit python's urllib:

  https://github.com/TecharoHQ/anubis/issues/1346

the bug indicates the rule was removed by default at that time,
however, rules have evolved further since then and look like they
are hitting our downloads. Adding the header is simple & harmless.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 tests/functional/qemu_test/asset.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tests/functional/qemu_test/asset.py b/tests/functional/qemu_test/asset.py
index 0abd89e0a38..ffa01aba2fb 100644
--- a/tests/functional/qemu_test/asset.py
+++ b/tests/functional/qemu_test/asset.py
@@ -137,7 +137,16 @@ def _try_to_fetch(self, tmp_cache_file):
         for _retries in range(3):
             try:
                 with tmp_cache_file.open("xb") as dst:
-                    with urllib.request.urlopen(self.url) as resp:
+                    req = urllib.request.Request(
+                        self.url,
+                        headers={
+                            # Workaround Anubis challenge which some sites
+                            # trigger when Accept is missing:
+                            #  https://github.com/TecharoHQ/anubis/issues/1346
+                            "Accept": "*/*",
+                        }
+                    )
+                    with urllib.request.urlopen(req) as resp:
                         copyfileobj(resp, dst)
                         length_hdr = resp.getheader("Content-Length")
 
-- 
2.56.1



  parent reply	other threads:[~2026-11-23 17:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 17:00 [PULL 0/6] Misc fixes patches Daniel P. Berrangé
2026-11-23 17:00 ` [PULL 1/6] crypto: avoid overwriting Error object erasing keyslot Daniel P. Berrangé
2026-11-23 17:00 ` [PULL 2/6] crypto: add newline in error hint messages Daniel P. Berrangé
2026-11-23 17:00 ` [PULL 3/6] tests/functional: update to newer sunxi kernel package Daniel P. Berrangé
2026-11-30 16:21   ` Brian Cain
2026-11-30 16:31     ` Brian Cain
2026-12-01  9:12     ` Daniel P. Berrangé
2026-11-23 17:00 ` Daniel P. Berrangé [this message]
2026-11-23 17:00 ` [PULL 5/6] docs: document 'unavailable' state is no longer output Daniel P. Berrangé
2026-11-23 17:00 ` [PULL 6/6] qapi: correctly mark 'ignore-unavailable' deprecated Daniel P. Berrangé
2026-11-23 20:32 ` [PULL 0/6] Misc fixes patches Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261123170050.4166517-5-berrange@redhat.com \
    --to=berrange@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.