]> Pileus Git - ~andy/fetchmail/blobdiff - transact.c
Complete Dominik's name.
[~andy/fetchmail] / transact.c
index 9667bd25a7041408826168a3bc1bf1714509ccd2..ec8013a516f03d1f66f83bf4af37a65e25ce0708 100644 (file)
@@ -487,7 +487,6 @@ int readheaders(int sock,
                char    *sp, *tp;
 
                set_timeout(mytimeout);
-               SockTimeout(sock, mytimeout);
                if ((n = SockRead(sock, buf, sizeof(buf)-1)) == -1) {
                    set_timeout(0);
                    free(line);
@@ -1409,7 +1408,6 @@ int readbody(int sock, struct query *ctl, flag forward, int len)
     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 */
@@ -1437,7 +1435,15 @@ int readbody(int sock, struct query *ctl, flag forward, int len)
         * 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;
@@ -1553,7 +1559,6 @@ va_dcl
     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)
@@ -1574,7 +1579,6 @@ int gen_recv(int sock  /** socket to which server is connected */,
 
     phase = SERVER_WAIT;
     set_timeout(mytimeout);
-    SockTimeout(sock, mytimeout);
     if (SockRead(sock, buf, size) == -1)
     {
        set_timeout(0);
@@ -1688,7 +1692,6 @@ int gen_recv_split(int sock  /** socket to which server is connected */,
 
        phase = SERVER_WAIT;
        set_timeout(mytimeout);
-       SockTimeout(sock, mytimeout);
        rr = SockRead(sock, buf + n, size - n);
        set_timeout(0);
        phase = oldphase;
@@ -1760,7 +1763,6 @@ va_dcl
     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 */