Merged with https://github.com/ytdl-org/youtube-dl/commit/e450f6cb634f17fd4ef59291eafb68b05c141e43
[ci skip]
Always request last data block of exact size remaining to download if possible not the current block size.
Always do this if possible, i.e. if Content-Length or expected length is known, not only in test. This will save unnecessary last extra loop trying to read 0 bytes.
To always ensure cookie name and value are bytestrings on python 2.
+ Add support for UTF-8 in cookie files * Skip malformed cookie file entries instead of crashing (invalid entry len, invalid expires at)