Index: src/OFHTTPClient.m ================================================================== --- src/OFHTTPClient.m +++ src/OFHTTPClient.m @@ -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;