Fossil SCM
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.
Commit
767ae79c3dcc16ba9923a4bbc708c5a662729aca
Parent
879e8c5f32be016…
2 files changed
+5
+4
+5
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -214,11 +214,16 @@ | ||
| 214 | 214 | blob_uncompress(pReply, pReply); |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /* |
| 218 | 218 | ** Close the connection to the server if appropriate. |
| 219 | + ** | |
| 220 | + ** FIXME: There is some bug in the lower layers that prevents the | |
| 221 | + ** connection from remaining open. The easiest fix for now is to | |
| 222 | + ** simply close and restart the connection for each round-trip. | |
| 219 | 223 | */ |
| 224 | + closeConnection = 1; /* FIX ME */ | |
| 220 | 225 | if( closeConnection ){ |
| 221 | 226 | transport_close(); |
| 222 | 227 | }else{ |
| 223 | 228 | transport_rewind(); |
| 224 | 229 | } |
| 225 | 230 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -214,11 +214,16 @@ | |
| 214 | blob_uncompress(pReply, pReply); |
| 215 | } |
| 216 | |
| 217 | /* |
| 218 | ** Close the connection to the server if appropriate. |
| 219 | */ |
| 220 | if( closeConnection ){ |
| 221 | transport_close(); |
| 222 | }else{ |
| 223 | transport_rewind(); |
| 224 | } |
| 225 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -214,11 +214,16 @@ | |
| 214 | blob_uncompress(pReply, pReply); |
| 215 | } |
| 216 | |
| 217 | /* |
| 218 | ** Close the connection to the server if appropriate. |
| 219 | ** |
| 220 | ** FIXME: There is some bug in the lower layers that prevents the |
| 221 | ** connection from remaining open. The easiest fix for now is to |
| 222 | ** simply close and restart the connection for each round-trip. |
| 223 | */ |
| 224 | closeConnection = 1; /* FIX ME */ |
| 225 | if( closeConnection ){ |
| 226 | transport_close(); |
| 227 | }else{ |
| 228 | transport_rewind(); |
| 229 | } |
| 230 |
+4
| --- src/http_transport.c | ||
| +++ src/http_transport.c | ||
| @@ -128,10 +128,11 @@ | ||
| 128 | 128 | fwrite(z, 1, n, transport.pFile); |
| 129 | 129 | }else{ |
| 130 | 130 | int sent; |
| 131 | 131 | while( n>0 ){ |
| 132 | 132 | sent = socket_send(0, z, n); |
| 133 | + /* printf("Sent %d of %d bytes\n", sent, n); fflush(stdout); */ | |
| 133 | 134 | if( sent<=0 ) break; |
| 134 | 135 | n -= sent; |
| 135 | 136 | } |
| 136 | 137 | } |
| 137 | 138 | } |
| @@ -173,10 +174,11 @@ | ||
| 173 | 174 | |
| 174 | 175 | onHand = transport.nUsed - transport.iCursor; |
| 175 | 176 | if( onHand>0 ){ |
| 176 | 177 | int toMove = onHand; |
| 177 | 178 | if( toMove>N ) toMove = N; |
| 179 | + /* printf("bytes on hand: %d of %d\n", toMove, N); fflush(stdout); */ | |
| 178 | 180 | memcpy(zBuf, &transport.pBuf[transport.iCursor], toMove); |
| 179 | 181 | transport.iCursor += toMove; |
| 180 | 182 | if( transport.iCursor>=transport.nUsed ){ |
| 181 | 183 | transport.nUsed = 0; |
| 182 | 184 | transport.iCursor = 0; |
| @@ -192,10 +194,11 @@ | ||
| 192 | 194 | got = 0; |
| 193 | 195 | }else if( g.urlIsFile ){ |
| 194 | 196 | got = fread(zBuf, 1, N, transport.pFile); |
| 195 | 197 | }else{ |
| 196 | 198 | got = socket_receive(0, zBuf, N); |
| 199 | + /* printf("received %d of %d bytes\n", got, N); fflush(stdout); */ | |
| 197 | 200 | } |
| 198 | 201 | if( got>0 ){ |
| 199 | 202 | nByte += got; |
| 200 | 203 | } |
| 201 | 204 | } |
| @@ -270,7 +273,8 @@ | ||
| 270 | 273 | } |
| 271 | 274 | break; |
| 272 | 275 | } |
| 273 | 276 | i++; |
| 274 | 277 | } |
| 278 | + /* printf("Got line: [%s]\n", &transport.pBuf[iStart]); */ | |
| 275 | 279 | return &transport.pBuf[iStart]; |
| 276 | 280 | } |
| 277 | 281 |
| --- src/http_transport.c | |
| +++ src/http_transport.c | |
| @@ -128,10 +128,11 @@ | |
| 128 | fwrite(z, 1, n, transport.pFile); |
| 129 | }else{ |
| 130 | int sent; |
| 131 | while( n>0 ){ |
| 132 | sent = socket_send(0, z, n); |
| 133 | if( sent<=0 ) break; |
| 134 | n -= sent; |
| 135 | } |
| 136 | } |
| 137 | } |
| @@ -173,10 +174,11 @@ | |
| 173 | |
| 174 | onHand = transport.nUsed - transport.iCursor; |
| 175 | if( onHand>0 ){ |
| 176 | int toMove = onHand; |
| 177 | if( toMove>N ) toMove = N; |
| 178 | memcpy(zBuf, &transport.pBuf[transport.iCursor], toMove); |
| 179 | transport.iCursor += toMove; |
| 180 | if( transport.iCursor>=transport.nUsed ){ |
| 181 | transport.nUsed = 0; |
| 182 | transport.iCursor = 0; |
| @@ -192,10 +194,11 @@ | |
| 192 | got = 0; |
| 193 | }else if( g.urlIsFile ){ |
| 194 | got = fread(zBuf, 1, N, transport.pFile); |
| 195 | }else{ |
| 196 | got = socket_receive(0, zBuf, N); |
| 197 | } |
| 198 | if( got>0 ){ |
| 199 | nByte += got; |
| 200 | } |
| 201 | } |
| @@ -270,7 +273,8 @@ | |
| 270 | } |
| 271 | break; |
| 272 | } |
| 273 | i++; |
| 274 | } |
| 275 | return &transport.pBuf[iStart]; |
| 276 | } |
| 277 |
| --- src/http_transport.c | |
| +++ src/http_transport.c | |
| @@ -128,10 +128,11 @@ | |
| 128 | fwrite(z, 1, n, transport.pFile); |
| 129 | }else{ |
| 130 | int sent; |
| 131 | while( n>0 ){ |
| 132 | sent = socket_send(0, z, n); |
| 133 | /* printf("Sent %d of %d bytes\n", sent, n); fflush(stdout); */ |
| 134 | if( sent<=0 ) break; |
| 135 | n -= sent; |
| 136 | } |
| 137 | } |
| 138 | } |
| @@ -173,10 +174,11 @@ | |
| 174 | |
| 175 | onHand = transport.nUsed - transport.iCursor; |
| 176 | if( onHand>0 ){ |
| 177 | int toMove = onHand; |
| 178 | if( toMove>N ) toMove = N; |
| 179 | /* printf("bytes on hand: %d of %d\n", toMove, N); fflush(stdout); */ |
| 180 | memcpy(zBuf, &transport.pBuf[transport.iCursor], toMove); |
| 181 | transport.iCursor += toMove; |
| 182 | if( transport.iCursor>=transport.nUsed ){ |
| 183 | transport.nUsed = 0; |
| 184 | transport.iCursor = 0; |
| @@ -192,10 +194,11 @@ | |
| 194 | got = 0; |
| 195 | }else if( g.urlIsFile ){ |
| 196 | got = fread(zBuf, 1, N, transport.pFile); |
| 197 | }else{ |
| 198 | got = socket_receive(0, zBuf, N); |
| 199 | /* printf("received %d of %d bytes\n", got, N); fflush(stdout); */ |
| 200 | } |
| 201 | if( got>0 ){ |
| 202 | nByte += got; |
| 203 | } |
| 204 | } |
| @@ -270,7 +273,8 @@ | |
| 273 | } |
| 274 | break; |
| 275 | } |
| 276 | i++; |
| 277 | } |
| 278 | /* printf("Got line: [%s]\n", &transport.pBuf[iStart]); */ |
| 279 | return &transport.pBuf[iStart]; |
| 280 | } |
| 281 |