have "proper" lines with the same length. With an old uw server I discovered
that lines were split in the middle by \n. This fix will correct it.
The rfc about base64 decoding does not mention anything about line length.
rfc2045 does mention that lines should not be longer then 78 characters but
does not say all the lines (excluding the last of course) must be of the same
size.
There for i could not ignore it and fixed it.
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5415
7612ce4b-ef26-0410-bec9-
ea0150e637f0
break;
}
$iRetrieved += $iBufferSize;
+ // if the returned lines are split, do not end with \n
+ // then we have a problem and need to adjust (happened with uw)
+ if ($bBufferSizeAdapted && substr($sRead,-1) !== "\n") {
+ // use fgets because it stops at \n.
+ // we can do it because it's for correction
+ $sRead .= fgets($imap_stream,$iBufferSize);
+ $iRetrieved += strlen($sRead);
+ if ($iRetrieved == $iSize) {
+ $bFinished = true;
+ }
+ }
if ($filter) {
// in case line-endings do not appear at position 78 we adapt the buffersize so we can base64 decode on the fly
if (!$bBufferSizeAdapted) {