Mercurial > vim
comparison src/testdir/test_channel.py @ 7937:2e905dfc6999 v7.4.1264
commit https://github.com/vim/vim/commit/6076fe1986255d32b7a078a28bf9e7bea19d6f30
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Feb 5 22:49:56 2016 +0100
patch 7.4.1264
Problem: Crash when receiving an empty array.
Solution: Check for array with wrong number of arguments. (Damien)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 05 Feb 2016 23:00:05 +0100 |
parents | 1ebc7be4dbbf |
children | dcc0bd6b1574 |
comparison
equal
deleted
inserted
replaced
7936:a058fba2b5fd | 7937:2e905dfc6999 |
---|---|
91 # Send an eval request missing the third argument. | 91 # Send an eval request missing the third argument. |
92 cmd = '["eval","xxx"]' | 92 cmd = '["eval","xxx"]' |
93 print("sending: {}".format(cmd)) | 93 print("sending: {}".format(cmd)) |
94 self.request.sendall(cmd.encode('utf-8')) | 94 self.request.sendall(cmd.encode('utf-8')) |
95 response = "ok" | 95 response = "ok" |
96 elif decoded[1] == 'empty-request': | |
97 cmd = '[]' | |
98 print("sending: {}".format(cmd)) | |
99 self.request.sendall(cmd.encode('utf-8')) | |
100 response = "ok" | |
96 elif decoded[1] == 'eval-result': | 101 elif decoded[1] == 'eval-result': |
97 # Send back the last received eval result. | 102 # Send back the last received eval result. |
98 response = last_eval | 103 response = last_eval |
99 elif decoded[1] == '!quit!': | 104 elif decoded[1] == '!quit!': |
100 # we're done | 105 # we're done |
121 HOST, PORT = "localhost", 0 | 126 HOST, PORT = "localhost", 0 |
122 | 127 |
123 server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler) | 128 server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler) |
124 ip, port = server.server_address | 129 ip, port = server.server_address |
125 | 130 |
126 # Start a thread with the server -- that thread will then start one | 131 # Start a thread with the server. That thread will then start a new thread |
127 # more thread for each request | 132 # for each connection. |
128 server_thread = threading.Thread(target=server.serve_forever) | 133 server_thread = threading.Thread(target=server.serve_forever) |
129 | |
130 # Exit the server thread when the main thread terminates | |
131 server_thread.start() | 134 server_thread.start() |
132 | 135 |
133 # Write the port number in Xportnr, so that the test knows it. | 136 # Write the port number in Xportnr, so that the test knows it. |
134 f = open("Xportnr", "w") | 137 f = open("Xportnr", "w") |
135 f.write("{}".format(port)) | 138 f.write("{}".format(port)) |