@@ -1,7 +1,7 @@ /* - * Copyright (c) 2008-2023 Jonathan Schleifer + * Copyright (c) 2008-2024 Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in @@ -916,16 +916,16 @@ - (size_t)lowlevelReadIntoBuffer: (void *)buffer length: (size_t)length { if (_stream == nil) @throw [OFNotOpenException exceptionWithObject: self]; + if (!_hasContentLength && !_chunked) + return [_stream readIntoBuffer: buffer length: length]; + if (_atEndOfStream) return 0; - if (!_hasContentLength && !_chunked) - return [_stream readIntoBuffer: buffer length: length]; - if (_stream.atEndOfStream) @throw [OFTruncatedDataException exception]; /* Content-Length */ if (!_chunked) { @@ -1045,13 +1045,10 @@ } } - (bool)lowlevelIsAtEndOfStream { - if (_atEndOfStream) - return true; - if (_stream == nil) @throw [OFNotOpenException exceptionWithObject: self]; if (!_hasContentLength && !_chunked) return _stream.atEndOfStream;