'From Squeak3.8gamma of ''24 November 2004'' [latest update: #6569] on 24 February 2005 at 6:38:46 pm'! "Change Set: FTPMultiLineFix-nk Date: 24 February 2005 Author: Ned Konz Fixes fetchNextResponse so that it properly handles multi-line FTP responses. "! !TelnetProtocolClient methodsFor: 'private protocol' stamp: 'nk 2/24/2005 18:21'! fetchNextResponse "The FTP and similar protocols allow multi-line responses. If the response is multi-line, the fourth character of the first line is a $- and the last line repeats the numeric code but the code is followed by a space." | response result firstLine | result := '' writeStream. firstLine := self stream nextLine. result nextPutAll: firstLine. (self responseIsContinuation: firstLine) ifTrue: ["continued over multiple lines. Discard continuation lines." [response := self stream nextLine. response ifNil: [^nil]. response size > 3 and: [(response copyFrom: 1 to: 3) = (firstLine copyFrom: 1 to: 3) and: [(response at: 4) = Character space]]] whileFalse: [result cr; nextPutAll: response]]. self lastResponse: result contents! !