Blame SOURCES/0103-curl-7.59.0-python3.patch

d73b74
From bdba7b54224814055185513de1e7ff6619031553 Mon Sep 17 00:00:00 2001
d73b74
From: Kamil Dudka <kdudka@redhat.com>
d73b74
Date: Thu, 15 Mar 2018 13:21:40 +0100
d73b74
Subject: [PATCH 1/2] tests/http_pipe.py: migrate to Python 3
d73b74
d73b74
---
d73b74
 tests/http_pipe.py | 4 ++--
d73b74
 tests/runtests.pl  | 2 +-
d73b74
 2 files changed, 3 insertions(+), 3 deletions(-)
d73b74
d73b74
diff --git a/tests/http_pipe.py b/tests/http_pipe.py
d73b74
index bc32173..75ac165 100755
d73b74
--- a/tests/http_pipe.py
d73b74
+++ b/tests/http_pipe.py
d73b74
@@ -383,13 +383,13 @@ class PipelineRequestHandler(socketserver.BaseRequestHandler):
d73b74
           self.request.setblocking(True)
d73b74
           if not new_data:
d73b74
             return
d73b74
-          new_requests = self._request_parser.ParseAdditionalData(new_data)
d73b74
+          new_requests = self._request_parser.ParseAdditionalData(new_data.decode('utf8'))
d73b74
           self._response_builder.QueueRequests(
d73b74
               new_requests, self._request_parser.were_all_requests_http_1_1)
d73b74
           self._num_queued += len(new_requests)
d73b74
           self._last_queued_time = time.time()
d73b74
         elif fileno in wlist:
d73b74
-          num_bytes_sent = self.request.send(self._send_buffer[0:4096])
d73b74
+          num_bytes_sent = self.request.send(self._send_buffer[0:4096].encode('utf8'))
d73b74
           self._send_buffer = self._send_buffer[num_bytes_sent:]
d73b74
           time.sleep(0.05)
d73b74
 
d73b74
diff --git a/tests/runtests.pl b/tests/runtests.pl
d73b74
index d6aa5ca..4d395ef 100755
d73b74
--- a/tests/runtests.pl
d73b74
+++ b/tests/runtests.pl
d73b74
@@ -1439,7 +1439,7 @@ sub runhttpserver {
d73b74
     elsif($alt eq "pipe") {
d73b74
         # basically the same, but another ID
d73b74
         $idnum = 3;
d73b74
-        $exe = "python $srcdir/http_pipe.py";
d73b74
+        $exe = "python3 $srcdir/http_pipe.py";
d73b74
         $verbose_flag .= "1 ";
d73b74
     }
d73b74
     elsif($alt eq "unix") {
d73b74
-- 
d73b74
2.14.3
d73b74
d73b74
d73b74
From 3c4c7340e455b7256c0786759422f34ec3e2d440 Mon Sep 17 00:00:00 2001
d73b74
From: Kamil Dudka <kdudka@redhat.com>
d73b74
Date: Thu, 15 Mar 2018 14:49:56 +0100
d73b74
Subject: [PATCH 2/2] tests/{negtelnet,smb}server.py: migrate to Python 3
d73b74
d73b74
Unfortunately, smbserver.py does not work with Python 3 because
d73b74
there is no 'impacket' module available for Python 3:
d73b74
d73b74
https://github.com/CoreSecurity/impacket/issues/61
d73b74
---
d73b74
 tests/negtelnetserver.py | 12 ++++++------
d73b74
 tests/smbserver.py       |  4 ++--
d73b74
 2 files changed, 8 insertions(+), 8 deletions(-)
d73b74
d73b74
diff --git a/tests/negtelnetserver.py b/tests/negtelnetserver.py
d73b74
index 8cfd409..72ee771 100755
d73b74
--- a/tests/negtelnetserver.py
d73b74
+++ b/tests/negtelnetserver.py
d73b74
@@ -23,7 +23,7 @@ IDENT = "NTEL"
d73b74
 
d73b74
 # The strings that indicate the test framework is checking our aliveness
d73b74
 VERIFIED_REQ = b"verifiedserver"
d73b74
-VERIFIED_RSP = b"WE ROOLZ: {pid}"
d73b74
+VERIFIED_RSP = "WE ROOLZ: {pid}"
d73b74
 
d73b74
 
d73b74
 def telnetserver(options):
d73b74
@@ -34,7 +34,7 @@ def telnetserver(options):
d73b74
     if options.pidfile:
d73b74
         pid = os.getpid()
d73b74
         with open(options.pidfile, "w") as f:
d73b74
-            f.write(b"{0}".format(pid))
d73b74
+            f.write("{0}".format(pid))
d73b74
 
d73b74
     local_bind = (HOST, options.port)
d73b74
     log.info("Listening on %s", local_bind)
d73b74
@@ -73,11 +73,11 @@ class NegotiatingTelnetHandler(socketserver.BaseRequestHandler):
d73b74
                 response_data = VERIFIED_RSP.format(pid=os.getpid())
d73b74
             else:
d73b74
                 log.debug("Received normal request - echoing back")
d73b74
-                response_data = data.strip()
d73b74
+                response_data = data.decode('utf8').strip()
d73b74
 
d73b74
             if response_data:
d73b74
                 log.debug("Sending %r", response_data)
d73b74
-                self.request.sendall(response_data)
d73b74
+                self.request.sendall(response_data.encode('utf8'))
d73b74
 
d73b74
         except IOError:
d73b74
             log.exception("IOError hit during request")
d73b74
@@ -132,7 +132,7 @@ class Negotiator(object):
d73b74
         return buffer
d73b74
 
d73b74
     def byte_to_int(self, byte):
d73b74
-        return struct.unpack(b'B', byte)[0]
d73b74
+        return int(byte)
d73b74
 
d73b74
     def no_neg(self, byte, byte_int, buffer):
d73b74
         # Not negotiating anything thus far. Check to see if we
d73b74
@@ -197,7 +197,7 @@ class Negotiator(object):
d73b74
         self.tcp.sendall(packed_message)
d73b74
 
d73b74
     def pack(self, arr):
d73b74
-        return struct.pack(b'{0}B'.format(len(arr)), *arr)
d73b74
+        return struct.pack('{0}B'.format(len(arr)), *arr)
d73b74
 
d73b74
     def send_iac(self, arr):
d73b74
         message = [NegTokens.IAC]
d73b74
diff --git a/tests/smbserver.py b/tests/smbserver.py
d73b74
index 195ae39..b09cd44 100755
d73b74
--- a/tests/smbserver.py
d73b74
+++ b/tests/smbserver.py
d73b74
@@ -24,7 +24,7 @@
d73b74
 from __future__ import (absolute_import, division, print_function)
d73b74
 # unicode_literals)
d73b74
 import argparse
d73b74
-import ConfigParser
d73b74
+import configparser
d73b74
 import os
d73b74
 import sys
d73b74
 import logging
d73b74
@@ -58,7 +58,7 @@ def smbserver(options):
d73b74
             f.write("{0}".format(pid))
d73b74
 
d73b74
     # Here we write a mini config for the server
d73b74
-    smb_config = ConfigParser.ConfigParser()
d73b74
+    smb_config = configparser.ConfigParser()
d73b74
     smb_config.add_section("global")
d73b74
     smb_config.set("global", "server_name", "SERVICE")
d73b74
     smb_config.set("global", "server_os", "UNIX")
d73b74
-- 
d73b74
2.14.3
d73b74