Fossil SCM

Abort clone if we don't get the full payload until we have a better way to handle partial clones.

andybradford 2015-01-10 02:54 trunk
Commit e1893dc6ab8f3ae8da3580c14c0581732cc36ec4
1 file changed +7 -2
+7 -2
--- src/http.c
+++ src/http.c
@@ -205,11 +205,12 @@
205205
int http_exchange(Blob *pSend, Blob *pReply, int useLogin, int maxRedirect){
206206
Blob login; /* The login card */
207207
Blob payload; /* The complete payload including login card */
208208
Blob hdr; /* The HTTP request header */
209209
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 */
211212
int rc = 0; /* Result code */
212213
int iHttpVersion; /* Which version of HTTP protocol server uses */
213214
char *zLine; /* A single line of the reply header */
214215
int i; /* Loop counter */
215216
int isError = 0; /* True if the reply is an error message */
@@ -370,11 +371,15 @@
370371
/*
371372
** Extract the reply payload that follows the header
372373
*/
373374
blob_zero(pReply);
374375
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
+ }
376381
blob_resize(pReply, iLength);
377382
if( isError ){
378383
char *z;
379384
int i, j;
380385
z = blob_str(pReply);
381386
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button