Fossil SCM
Abort clone if we don't get the full payload until we have a better way to handle partial clones.
Commit
e1893dc6ab8f3ae8da3580c14c0581732cc36ec4
Parent
379ce043c16d808…
1 file changed
+7
-2
+7
-2
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -205,11 +205,12 @@ | ||
| 205 | 205 | int http_exchange(Blob *pSend, Blob *pReply, int useLogin, int maxRedirect){ |
| 206 | 206 | Blob login; /* The login card */ |
| 207 | 207 | Blob payload; /* The complete payload including login card */ |
| 208 | 208 | Blob hdr; /* The HTTP request header */ |
| 209 | 209 | int closeConnection; /* True to close the connection when done */ |
| 210 | - int iLength; /* Length of the reply payload */ | |
| 210 | + int iLength; /* Expected length of the reply payload */ | |
| 211 | + int iRecvLen; /* Received length of the reply payload */ | |
| 211 | 212 | int rc = 0; /* Result code */ |
| 212 | 213 | int iHttpVersion; /* Which version of HTTP protocol server uses */ |
| 213 | 214 | char *zLine; /* A single line of the reply header */ |
| 214 | 215 | int i; /* Loop counter */ |
| 215 | 216 | int isError = 0; /* True if the reply is an error message */ |
| @@ -370,11 +371,15 @@ | ||
| 370 | 371 | /* |
| 371 | 372 | ** Extract the reply payload that follows the header |
| 372 | 373 | */ |
| 373 | 374 | blob_zero(pReply); |
| 374 | 375 | blob_resize(pReply, iLength); |
| 375 | - iLength = transport_receive(&g.url, blob_buffer(pReply), iLength); | |
| 376 | + iRecvLen = transport_receive(&g.url, blob_buffer(pReply), iLength); | |
| 377 | + if( iRecvLen != iLength ){ | |
| 378 | + fossil_warning("response truncated: got %d bytes of %d", iRecvLen, iLength); | |
| 379 | + goto write_err; | |
| 380 | + } | |
| 376 | 381 | blob_resize(pReply, iLength); |
| 377 | 382 | if( isError ){ |
| 378 | 383 | char *z; |
| 379 | 384 | int i, j; |
| 380 | 385 | z = blob_str(pReply); |
| 381 | 386 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -205,11 +205,12 @@ | |
| 205 | int http_exchange(Blob *pSend, Blob *pReply, int useLogin, int maxRedirect){ |
| 206 | Blob login; /* The login card */ |
| 207 | Blob payload; /* The complete payload including login card */ |
| 208 | Blob hdr; /* The HTTP request header */ |
| 209 | int closeConnection; /* True to close the connection when done */ |
| 210 | int iLength; /* Length of the reply payload */ |
| 211 | int rc = 0; /* Result code */ |
| 212 | int iHttpVersion; /* Which version of HTTP protocol server uses */ |
| 213 | char *zLine; /* A single line of the reply header */ |
| 214 | int i; /* Loop counter */ |
| 215 | int isError = 0; /* True if the reply is an error message */ |
| @@ -370,11 +371,15 @@ | |
| 370 | /* |
| 371 | ** Extract the reply payload that follows the header |
| 372 | */ |
| 373 | blob_zero(pReply); |
| 374 | blob_resize(pReply, iLength); |
| 375 | iLength = transport_receive(&g.url, blob_buffer(pReply), iLength); |
| 376 | blob_resize(pReply, iLength); |
| 377 | if( isError ){ |
| 378 | char *z; |
| 379 | int i, j; |
| 380 | z = blob_str(pReply); |
| 381 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -205,11 +205,12 @@ | |
| 205 | int http_exchange(Blob *pSend, Blob *pReply, int useLogin, int maxRedirect){ |
| 206 | Blob login; /* The login card */ |
| 207 | Blob payload; /* The complete payload including login card */ |
| 208 | Blob hdr; /* The HTTP request header */ |
| 209 | int closeConnection; /* True to close the connection when done */ |
| 210 | int iLength; /* Expected length of the reply payload */ |
| 211 | int iRecvLen; /* Received length of the reply payload */ |
| 212 | int rc = 0; /* Result code */ |
| 213 | int iHttpVersion; /* Which version of HTTP protocol server uses */ |
| 214 | char *zLine; /* A single line of the reply header */ |
| 215 | int i; /* Loop counter */ |
| 216 | int isError = 0; /* True if the reply is an error message */ |
| @@ -370,11 +371,15 @@ | |
| 371 | /* |
| 372 | ** Extract the reply payload that follows the header |
| 373 | */ |
| 374 | blob_zero(pReply); |
| 375 | blob_resize(pReply, iLength); |
| 376 | iRecvLen = transport_receive(&g.url, blob_buffer(pReply), iLength); |
| 377 | if( iRecvLen != iLength ){ |
| 378 | fossil_warning("response truncated: got %d bytes of %d", iRecvLen, iLength); |
| 379 | goto write_err; |
| 380 | } |
| 381 | blob_resize(pReply, iLength); |
| 382 | if( isError ){ |
| 383 | char *z; |
| 384 | int i, j; |
| 385 | z = blob_str(pReply); |
| 386 |