Yann Leboulanger pushed to branch master at gajim / python-nbxmpp

Commits:
bda75fdf by Yann Leboulanger at 2017-11-14T17:57:40+01:00
fix BOSH connexion

- - - - -


2 changed files:

- nbxmpp/bosh.py
- nbxmpp/transports_nb.py


Changes:

=====================================
nbxmpp/bosh.py
=====================================
--- a/nbxmpp/bosh.py
+++ b/nbxmpp/bosh.py
@@ -547,10 +547,10 @@ class KeyStack(object):
         self.first_call = True
 
     def reset(self):
-        seed = str(get_rand_number())
+        seed = str(get_rand_number()).encode('utf-8')
         self.keys = [sha1(seed).hexdigest()]
         for i in range(self.count-1):
-            curr_seed = self.keys[i]
+            curr_seed = self.keys[i].encode('utf-8')
             self.keys.append(sha1(curr_seed).hexdigest())
 
     def get(self):


=====================================
nbxmpp/transports_nb.py
=====================================
--- a/nbxmpp/transports_nb.py
+++ b/nbxmpp/transports_nb.py
@@ -784,7 +784,7 @@ class NonBlockingHTTP(NonBlockingTCP):
                 'Host: %s:%s' % (self.http_host, self.http_port),
                 'User-Agent: Gajim',
                 'Content-Type: text/xml; charset=utf-8',
-                'Content-Length: %s' % len(str(httpbody))]
+                'Content-Length: %s' % len(httpbody)]
         if self.add_proxy_headers:
             headers.append('Proxy-Connection: keep-alive')
             headers.append('Pragma: no-cache')
@@ -796,7 +796,7 @@ class NonBlockingHTTP(NonBlockingTCP):
             headers.append('Connection: Keep-Alive')
         headers.append('\r\n')
         headers = '\r\n'.join(headers)
-        return '%s%s' % (headers, httpbody)
+        return b'%s%s' % (headers.encode('utf-8'), httpbody)
 
     def parse_http_message(self, message):
         """



View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/commit/bda75fdfc0d0fd37370cd63afa13aa47935bdab1

---
View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/commit/bda75fdfc0d0fd37370cd63afa13aa47935bdab1
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to