0
0
mirror of https://github.com/vim/vim.git synced 2025-10-02 05:04:20 -04:00

patch 7.4.2258

Problem:    Two JSON messages are sent without a separator.
Solution:   Separate messages with a NL. (closes #1001)
This commit is contained in:
Bram Moolenaar
2016-08-26 17:58:53 +02:00
parent 9f28953f0c
commit f1f0792e55
7 changed files with 53 additions and 18 deletions

View File

@@ -38,15 +38,15 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
print("received: {0}".format(received))
# We may receive two messages at once. Take the part up to the
# matching "]" (recognized by finding "][").
# newline, which should be after the matching "]".
todo = received
while todo != '':
splitidx = todo.find('][')
splitidx = todo.find('\n')
if splitidx < 0:
used = todo
todo = ''
else:
used = todo[:splitidx + 1]
used = todo[:splitidx]
todo = todo[splitidx + 1:]
if used != received:
print("using: {0}".format(used))