char *sp, *tp;
set_timeout(mytimeout);
- SockTimeout(sock, mytimeout);
if ((n = SockRead(sock, buf, sizeof(buf)-1)) == -1) {
set_timeout(0);
free(line);
while (protocol->delimited || len > 0)
{
set_timeout(mytimeout);
- SockTimeout(sock, mytimeout);
/* XXX FIXME: for undelimited protocols that ship the size, such
* as IMAP, we might want to use the count of remaining characters
* instead of the buffer size -- not for fetchmail 6.3.X though */
* so we might end truncating messages prematurely.
*/
if (!protocol->delimited && linelen > len) {
+ /* FIXME: HACK ALERT! This \r\n is only here to make sure the
+ * \n\0 hunt works later on. The \n generated here was not
+ * part of the original message!
+ * The real fix will be to use buffer + length strings,
+ * rather than 0-terminated C strings. */
+ inbufp[len++] = '\r';
+ inbufp[len++] = '\n';
inbufp[len] = '\0';
+ linelen = len;
}
len -= linelen;
va_end(ap);
snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "\r\n");
- SockTimeout(sock, mytimeout);
SockWrite(sock, buf, strlen(buf));
if (outlevel >= O_MONITOR)
phase = SERVER_WAIT;
set_timeout(mytimeout);
- SockTimeout(sock, mytimeout);
if (SockRead(sock, buf, size) == -1)
{
set_timeout(0);
phase = SERVER_WAIT;
set_timeout(mytimeout);
- SockTimeout(sock, mytimeout);
rr = SockRead(sock, buf + n, size - n);
set_timeout(0);
phase = oldphase;
va_end(ap);
snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "\r\n");
- SockTimeout(sock, mytimeout);
ok = SockWrite(sock, buf, strlen(buf));
if (ok == -1 || (size_t)ok != strlen(buf)) {
/* short write, bail out */