Check-in [767ae79c3d]
Not logged in
Overview

SHA1 Hash:767ae79c3dcc16ba9923a4bbc708c5a662729aca
Date: 2009-04-24 18:40:03
User: drh
Comment:There is some bug in the new HTTP transport layer. The easiest solution is to close the TCP connection after each round trip, which is what this check-in does.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/http.c from [14fbdbab26] to [15b4647138].

@@ -214,11 +214,16 @@
     blob_uncompress(pReply, pReply);
   }
 
   /*
   ** Close the connection to the server if appropriate.
+  **
+  ** FIXME:  There is some bug in the lower layers that prevents the
+  ** connection from remaining open.  The easiest fix for now is to
+  ** simply close and restart the connection for each round-trip.
   */
+  closeConnection = 1; /* FIX ME */
   if( closeConnection ){
     transport_close();
   }else{
     transport_rewind();
   }

Modified src/http_transport.c from [7621af4b14] to [cbbda92e40].

@@ -128,10 +128,11 @@
     fwrite(z, 1, n, transport.pFile);
   }else{
     int sent;
     while( n>0 ){
       sent = socket_send(0, z, n);
+      /* printf("Sent %d of %d bytes\n", sent, n); fflush(stdout); */
       if( sent<=0 ) break;
       n -= sent;
     }
   }
 }
@@ -173,10 +174,11 @@
 
   onHand = transport.nUsed - transport.iCursor;
   if( onHand>0 ){
     int toMove = onHand;
     if( toMove>N ) toMove = N;
+    /* printf("bytes on hand: %d of %d\n", toMove, N); fflush(stdout); */
     memcpy(zBuf, &transport.pBuf[transport.iCursor], toMove);
     transport.iCursor += toMove;
     if( transport.iCursor>=transport.nUsed ){
       transport.nUsed = 0;
       transport.iCursor = 0;
@@ -192,10 +194,11 @@
       got = 0;
     }else if( g.urlIsFile ){
       got = fread(zBuf, 1, N, transport.pFile);
     }else{
       got = socket_receive(0, zBuf, N);
+      /* printf("received %d of %d bytes\n", got, N); fflush(stdout); */
     }
     if( got>0 ){
       nByte += got;
     }
   }
@@ -270,7 +273,8 @@
       }
       break;
     }
     i++;
   }
+  /* printf("Got line: [%s]\n", &transport.pBuf[iStart]); */
   return &transport.pBuf[iStart];
 }