Fossil SCM
If the reply to an HTTP request omits the content-length, assume that the server wants us to close the connection. [forum:/forumpost/815e4320c8|Forum post 815e4320c8].
Commit
aa7a08772613605bbcd68c81d40a7886d464cf2a33ccae153a16d1434b46b003
Parent
bd70ec5fda11e05…
1 file changed
+2
-6
+2
-6
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -751,15 +751,16 @@ | ||
| 751 | 751 | if( mHttpFlags & HTTP_QUIET ) goto write_err; |
| 752 | 752 | fossil_warning("response truncated: got %d bytes of %d", |
| 753 | 753 | iRecvLen, iLength); |
| 754 | 754 | goto write_err; |
| 755 | 755 | } |
| 756 | - }else if( closeConnection ){ | |
| 756 | + }else{ | |
| 757 | 757 | /* Read content until end-of-file */ |
| 758 | 758 | int iRecvLen; /* Received length of the reply payload */ |
| 759 | 759 | unsigned int nReq = 1000; |
| 760 | 760 | unsigned int nPrior = 0; |
| 761 | + closeConnection = 1; | |
| 761 | 762 | do{ |
| 762 | 763 | nReq *= 2; |
| 763 | 764 | blob_resize(pReply, nPrior+nReq); |
| 764 | 765 | iRecvLen = transport_receive(&g.url, &pReply->aData[nPrior], (int)nReq); |
| 765 | 766 | nPrior += iRecvLen; |
| @@ -766,15 +767,10 @@ | ||
| 766 | 767 | pReply->nUsed = nPrior; |
| 767 | 768 | }while( iRecvLen==nReq && nReq<0x20000000 ); |
| 768 | 769 | if( mHttpFlags & HTTP_VERBOSE ){ |
| 769 | 770 | fossil_print("Reply received: %u bytes (w/o content-length)\n", nPrior); |
| 770 | 771 | } |
| 771 | - }else{ | |
| 772 | - assert( iLength<0 && !closeConnection ); | |
| 773 | - if( mHttpFlags & HTTP_QUIET ) goto write_err; | |
| 774 | - fossil_warning("\"content-length\" missing from %d keep-alive reply", rc); | |
| 775 | - goto write_err; | |
| 776 | 772 | } |
| 777 | 773 | if( isError ){ |
| 778 | 774 | char *z; |
| 779 | 775 | int i, j; |
| 780 | 776 | z = blob_str(pReply); |
| 781 | 777 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -751,15 +751,16 @@ | |
| 751 | if( mHttpFlags & HTTP_QUIET ) goto write_err; |
| 752 | fossil_warning("response truncated: got %d bytes of %d", |
| 753 | iRecvLen, iLength); |
| 754 | goto write_err; |
| 755 | } |
| 756 | }else if( closeConnection ){ |
| 757 | /* Read content until end-of-file */ |
| 758 | int iRecvLen; /* Received length of the reply payload */ |
| 759 | unsigned int nReq = 1000; |
| 760 | unsigned int nPrior = 0; |
| 761 | do{ |
| 762 | nReq *= 2; |
| 763 | blob_resize(pReply, nPrior+nReq); |
| 764 | iRecvLen = transport_receive(&g.url, &pReply->aData[nPrior], (int)nReq); |
| 765 | nPrior += iRecvLen; |
| @@ -766,15 +767,10 @@ | |
| 766 | pReply->nUsed = nPrior; |
| 767 | }while( iRecvLen==nReq && nReq<0x20000000 ); |
| 768 | if( mHttpFlags & HTTP_VERBOSE ){ |
| 769 | fossil_print("Reply received: %u bytes (w/o content-length)\n", nPrior); |
| 770 | } |
| 771 | }else{ |
| 772 | assert( iLength<0 && !closeConnection ); |
| 773 | if( mHttpFlags & HTTP_QUIET ) goto write_err; |
| 774 | fossil_warning("\"content-length\" missing from %d keep-alive reply", rc); |
| 775 | goto write_err; |
| 776 | } |
| 777 | if( isError ){ |
| 778 | char *z; |
| 779 | int i, j; |
| 780 | z = blob_str(pReply); |
| 781 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -751,15 +751,16 @@ | |
| 751 | if( mHttpFlags & HTTP_QUIET ) goto write_err; |
| 752 | fossil_warning("response truncated: got %d bytes of %d", |
| 753 | iRecvLen, iLength); |
| 754 | goto write_err; |
| 755 | } |
| 756 | }else{ |
| 757 | /* Read content until end-of-file */ |
| 758 | int iRecvLen; /* Received length of the reply payload */ |
| 759 | unsigned int nReq = 1000; |
| 760 | unsigned int nPrior = 0; |
| 761 | closeConnection = 1; |
| 762 | do{ |
| 763 | nReq *= 2; |
| 764 | blob_resize(pReply, nPrior+nReq); |
| 765 | iRecvLen = transport_receive(&g.url, &pReply->aData[nPrior], (int)nReq); |
| 766 | nPrior += iRecvLen; |
| @@ -766,15 +767,10 @@ | |
| 767 | pReply->nUsed = nPrior; |
| 768 | }while( iRecvLen==nReq && nReq<0x20000000 ); |
| 769 | if( mHttpFlags & HTTP_VERBOSE ){ |
| 770 | fossil_print("Reply received: %u bytes (w/o content-length)\n", nPrior); |
| 771 | } |
| 772 | } |
| 773 | if( isError ){ |
| 774 | char *z; |
| 775 | int i, j; |
| 776 | z = blob_str(pReply); |
| 777 |