[Patches] oneliner for poplib bug

Caolan McNamara caolan@csn.ul.ie
Tue, 9 May 2000 08:26:50 +0100 (IST)


On Mon, 8 May 2000, Guido van Rossum wrote:

> |  		while line != '.':
> | +			if line[:1] == '.':
> | +				o = o-1
> | +				line = line[1:]
> 
> Hm, wouldn't it be safer if you did
> 
> 	if line[:2] == '..':
> 		o = o-1
> 		line = line[1:]
> 
> ???
> 
> That way if there was a line that *wasn't* bytestuffed (server bug?)
> the single leading dot wouldn't disappear.

Well the spec does say that 
"if the line begins with the termination octet and if
 octets other than CRLF follow, the first octet of the line 
 is stripped away by the client"

Though I do admit I can see no other case than that of a doubled ..
where it might happen seeing as 
"If any line of the multi-line response begins with the termination 
octet, the line is "byte-stuffed" [by the server] by pre-pending the 
termination octet to that line of the response."
So the second should also be ok.

C.

Real Life: Caolan McNamara           *  Doing: MSc in HCI
Work: Caolan.McNamara@ul.ie          *  Phone: +353-86-8790257
URL: http://www.csn.ul.ie/~caolan    *  Sig: an oblique strategy
Use an old idea