[Twisted-Python] patch for protocols.telnet.Telnet
Jeremy Noetzelman
jjn at kriln.com
Mon Oct 7 12:41:11 MDT 2002
There's a bug in the telnet protocol, which will only process one 'line'
per call to processChunk(). This is buggy, because if you send a large
amount of data to a connection, such as via copy/paste, it will only
process the first two lines of it, and you're stuck mashing the enter key
to get it to process the rest.
Patch makes it process all lines instead of just one.
Index: telnet.py
===================================================================
RCS file: /cvs/Twisted/twisted/protocols/telnet.py,v
retrieving revision 1.16
diff -u -r1.16 telnet.py
--- telnet.py 15 Jul 2002 23:51:33 -0000 1.16
+++ telnet.py 7 Oct 2002 18:35:02 -0000
@@ -250,12 +250,16 @@
idx = string.find(self.buffer, delim)
if idx != -1:
break
-
- if idx != -1:
+ while idx != -1:
buf, self.buffer = self.buffer[:idx], self.buffer[idx+2:]
self.processLine(buf)
if self.mode == 'Done':
self.transport.loseConnection()
+
+ for delim in self.delimiters:
+ idx = string.find(self.buffer, delim)
+ if idx != -1:
+ break
def dataReceived(self, data):
chunk = StringIO()
More information about the Twisted-Python
mailing list