Patchwork D11073: windows: make sure we fully read and cleany close the connection

login
register
mail settings
Submitter phabricator
Date July 10, 2021, 5:48 p.m.
Message ID <differential-rev-PHID-DREV-5kki4zxqt2yfxfhvu5h4-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49387/
State Superseded
Headers show

Comments

phabricator - July 10, 2021, 5:48 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Maybe this will prevent server on Windows to sometimes complains about the
  client closing the connection too soon. So we make sure we read everything and
  we officially close the connection.
  
  Hopefully Windows will be happier and the test will stop being flaky.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11073

AFFECTED FILES
  tests/get-with-headers.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

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