Ticket #328 (new support)

Opened 4 years ago

HttpAuthenticated: problems with long username/password

Reported by: gaetano Owned by: jortel
Priority: minor Milestone: 0.4
Component: suds (general) Version: 0.3.9
Keywords: Cc:
Blocked By: Blocking:

Description

base64.encodestring may return a multi-line string, if the input is big enough. So the generated http packet is invalid (contains multi-line Authorization header) if username/password are long. base64.b64encode works right.

--- suds/transport/http.py      (revisione 685)
+++ suds/transport/http.py      (copia locale)
@@ -179,9 +179,9 @@
     def addcredentials(self, request):
         credentials = self.credentials()
         if not (None in credentials):
-            encoded = base64.encodestring(':'.join(credentials))
-            basic = 'Basic %s' % encoded[:-1]
+            encoded = base64.b64encode(':'.join(credentials))
+            basic = 'Basic %s' % encoded
             request.headers['Authorization'] = basic

Note: See TracTickets for help on using tickets.