summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2017-10-08 20:06:59 -0700
committerDana Powers <dana.powers@gmail.com>2017-10-08 20:06:59 -0700
commitc06627a0907e58d8166bb5d8424fb54b997e43f2 (patch)
treee90218c42fb928aab1aa1a79f957553f01f70c75
parent4d6d9ec485f9b44bc7fa989c843d8b1dfdca9bb2 (diff)
downloadkafka-python-c06627a0907e58d8166bb5d8424fb54b997e43f2.tar.gz
Read gssapi token using decoded size
-rw-r--r--kafka/conn.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/kafka/conn.py b/kafka/conn.py
index cd79e7f..ce2487e 100644
--- a/kafka/conn.py
+++ b/kafka/conn.py
@@ -533,7 +533,9 @@ class BrokerConnection(object):
# establishes a security context, or it needs further token exchange.
# The gssapi will be able to identify the needed next step.
# The connection is closed on failure.
- response = self._sock.recv(2000)
+ header = self._sock.recv(4)
+ token_size = struct.unpack('>i', header)
+ received_token = self._sock.recv(token_size)
self._sock.setblocking(False)
except ConnectionError as e:
@@ -542,13 +544,6 @@ class BrokerConnection(object):
self.close(error=error)
return future.failure(error)
- # pass the received token back to gssapi, strip the first 4 bytes
- # dpkp note: what are the first four bytes here?
- # it seems likely that this is the encoded message size
- # which we should receive and parse first, then use to parse
- # the remainder of the token
- received_token = response[4:]
-
except Exception as e:
return future.failure(e)