[BUG] positionOfSubCollection:

Avi Bryant avi.bryant at gmail.com
Tue Jul 5 01:50:27 UTC 2005


'ab' readStream positionOfSubCollection: 'ab' "1  OK"
'aab' readStream positionOfSubCollection: 'ab'   "0   WRONG"

What's going on here is that positionOfSubCollection: is apparently  
being very naive: "is 'aa' = 'ab'?  No.  Ok, is 'b' = 'ab'?  No.  Ok,  
'aab' must not have 'ab' then.".  This is likely to cause problems in  
all kinds of places, but the specific place I ran into it was trying  
to upload a file ending in a CR to Comanche - it ends up looking for  
CRLF in CRCRLF with exactly the same results as the 'aab' example above.

Rather than trying to figure out how to fix this method, since it's  
only used by SocketStream, I thought I'd try out Göran's  
FastSocketStream instead.  That solved the problem nicely.

Incidentally, the initials on the latest  
#positionOfSubCollection:ifAbsent: are mine, because of a fix I  
submitted last December.  I don't think this fix caused the problem  
above (it was just for an off-by-one error), but I don't have the  
earlier version handy, so I can't be sure.  I also don't remember who  
the original author was, but perhaps they have some insight...

I'm posting this to the list rather than just to Mantis to a) warn  
people that they might want to use FastSocketStream if they're having  
trouble with HTTP uploads and b) ask, is there any reason we aren't  
looking at including FastSocketStream as the default SocketStream  
implementation in the image?  Göran, do you think it's ready, or are  
there still kinks to work out?

Avi


More information about the Squeak-dev mailing list