Skip to content

Commit d0ff764

Browse files
committed
Use CRLF for the legacy protocol
1 parent 2d7b3ad commit d0ff764

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

legacy-proxy/proxy.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ async def handle_connection(self, reader, writer):
149149

150150
await self.create_index()
151151

152+
CRLF = b"\r\n"
153+
152154
while True:
153155
try:
154156
line = await reader.readuntil(b"\n")
@@ -157,12 +159,12 @@ async def handle_connection(self, reader, writer):
157159

158160
try:
159161
response = await proto.handle_request(line.decode("ascii").split())
160-
writer.write(b"OK " + response.encode("ascii") + b"\n")
162+
writer.write(b"OK " + response.encode("ascii") + CRLF)
161163
except ProtocolError as ex:
162-
writer.write(b"ERR " + ex.msg.encode("ascii") + b"\n")
164+
writer.write(b"ERR " + ex.msg.encode("ascii") + CRLF)
163165
except Exception:
164166
traceback.print_exc()
165-
writer.write(b"ERR internal error\n")
167+
writer.write(b"ERR internal error" + CRLF)
166168

167169
await writer.drain()
168170
finally:

0 commit comments

Comments
 (0)