Issue #14132: Fix redirect handling when target is just a query string
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index c18e738..434d533 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -45,10 +45,11 @@
 
         # buffer to store data for verification in urlopen tests.
         buf = ""
-        fakesock = FakeSocket(fakedata)
 
         def connect(self):
-            self.sock = self.fakesock
+            self.sock = FakeSocket(self.fakedata)
+            self.__class__.fakesock = self.sock
+    FakeHTTPConnection.fakedata = fakedata
 
     return FakeHTTPConnection