@@ -783,10 +783,12 @@ else if (length > _toWrite) length = (size_t)_toWrite; ret = [_socket writeBuffer: buffer length: length]; + if (_chunked) + [_socket writeString: @"\r\n"]; if (ret > length) @throw [OFOutOfRangeException exception]; if (!_chunked) { @@ -815,11 +817,11 @@ { if (_socket == nil) @throw [OFNotOpenException exceptionWithObject: self]; if (_chunked) - [_socket writeString: @"0\r\n"]; + [_socket writeString: @"0\r\n\r\n"]; else if (_toWrite > 0) @throw [OFTruncatedDataException exception]; _socket.delegate = _handler; [_socket asyncReadLine];