diff tests/get-with-headers.py @ 7054:e837f2294643

get-with-headers: fix stream modes under Windows
author Patrick Mezard <pmezard@gmail.com>
date Sun, 28 Sep 2008 20:40:38 +0200
parents 22713dce19f6
children c5e37dc38a52
line wrap: on
line diff
--- a/tests/get-with-headers.py	Fri Sep 26 20:33:47 2008 +0200
+++ b/tests/get-with-headers.py	Sun Sep 28 20:40:38 2008 +0200
@@ -4,6 +4,14 @@
 a subset of the headers plus the body of the result."""
 
 import httplib, sys
+
+try:
+    import msvcrt, os
+    msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
+    msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
+except ImportError:
+    pass
+
 headers = [h.lower() for h in sys.argv[3:]]
 conn = httplib.HTTPConnection(sys.argv[1])
 conn.request("GET", sys.argv[2])