mirror of
https://github.com/processone/ejabberd
synced 2025-10-03 09:49:18 +02:00
Fix extauth.py failure in test suite with Python 3 (#3612)
This commit is contained in:
parent
7b33499811
commit
1ee64091b3
1 changed files with 7 additions and 1 deletions
|
@ -1,8 +1,14 @@
|
|||
import sys
|
||||
import struct
|
||||
|
||||
def read_from_stdin(bytes):
|
||||
if hasattr(sys.stdin, 'buffer'):
|
||||
return sys.stdin.buffer.read(bytes)
|
||||
else:
|
||||
return sys.stdin.read(bytes)
|
||||
|
||||
def read():
|
||||
(pkt_size,) = struct.unpack('>H', sys.stdin.read(2))
|
||||
(pkt_size,) = struct.unpack('>H', read_from_stdin(2))
|
||||
pkt = sys.stdin.read(pkt_size)
|
||||
cmd = pkt.split(':')[0]
|
||||
if cmd == 'auth':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue