get-with-headers: fix stream modes under Windows
[ original upstream descripton ]
--- a/tests/get-with-headers.py Wed Nov 28 08:38:42 2007 -0800
+++ 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])