diff --git a/tests/get-with-headers.py b/tests/get-with-headers.py
--- a/tests/get-with-headers.py
+++ b/tests/get-with-headers.py
@@ -84,7 +84,11 @@
                 b"%s: %s\n"
                 % (h.encode('ascii'), response.getheader(h).encode('ascii'))
             )
-    if not headeronly:
+    if headeronly:
+        # still read the body to prevent windows to be unhappy about that
+        # (this might some flakyness in test-hgweb-filelog.t on Windows)
+        data = response.read()
+    else:
         stdout.write(b'\n')
         data = response.read()
 
@@ -112,6 +116,9 @@
     if twice and response.getheader('ETag', None):
         tag = response.getheader('ETag')
 
+    # further try to please the windows-flakyness deity
+    conn.close()
+
     return response.status