@@ -690,10 +690,15 @@ _bufferLength - _bufferIndex == 0 && _state == STATE_BLOCK_HEADER); } - (void)close { + /* Give back our buffer to the stream, in case it's shared */ + [_stream unreadFromBuffer: _buffer + _bufferIndex + length: _bufferLength - _bufferIndex]; + _bufferIndex = _bufferLength = 0; + [_stream release]; _stream = nil; [super close]; }