We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d823526 commit 4a06713Copy full SHA for 4a06713
1 file changed
python/http_ece/__init__.py
@@ -232,10 +232,11 @@ def unpad_legacy(data):
232
def unpad(data, last):
233
i = len(data) - 1
234
for i in range(len(data) - 1, -1, -1):
235
- if data[i] != 0:
236
- if not last and data[i] != 1:
+ x = struct.unpack('B', data[i:i+1])[0]
+ if x != 0:
237
+ if not last and x != 1:
238
raise ECEException(u'record delimiter != 1')
- if last and data[i] != 2:
239
+ if last and x != 2:
240
raise ECEException(u'last record delimiter != 2')
241
return data[0:i]
242
i -= 1
0 commit comments