Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Fix out-of-order variable declaration (VC6 cannot handle that). Move MAX_REDIRECTS definition to xfer.c, so it can be converted to a fossil setting later. |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
fe56e5aa4f000b9498966c0aabf050e7 |
| User & Date: | jan.nijtmans 2013-02-01 12:33:13.711 |
Context
|
2013-02-06
| ||
| 12:00 | Set the execute permission bit on compat/zlib/configure. check-in: 6e685da390 user: drh tags: trunk | |
|
2013-02-05
| ||
| 23:40 | Merge from trunk. check-in: 21da639fee user: dg tags: dg-misc | |
|
2013-02-01
| ||
| 12:33 | Fix out-of-order variable declaration (VC6 cannot handle that). Move MAX_REDIRECTS definition to xfer.c, so it can be converted to a fossil setting later. check-in: fe56e5aa4f user: jan.nijtmans tags: trunk | |
| 07:01 | Limit the number of HTTP redirects that any http_exchange() call will follow to 20 (the limit used by most browsers). Previously, a misconfigured server or incorrect URL could cause Fossil to follow an endless trail of redirects without user intervention. check-in: 13ffb9b4d1 user: joel tags: trunk | |
Changes
Changes to src/http.c.
| ︙ | ︙ | |||
118 119 120 121 122 123 124 |
blob_appendf(pHdr, "Content-Type: application/x-fossil-debug\r\n");
}else{
blob_appendf(pHdr, "Content-Type: application/x-fossil\r\n");
}
blob_appendf(pHdr, "Content-Length: %d\r\n\r\n", blob_size(pPayload));
}
| < < < < < < | < < < < < < < < < | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
blob_appendf(pHdr, "Content-Type: application/x-fossil-debug\r\n");
}else{
blob_appendf(pHdr, "Content-Type: application/x-fossil\r\n");
}
blob_appendf(pHdr, "Content-Length: %d\r\n\r\n", blob_size(pPayload));
}
/*
** Sign the content in pSend, compress it, and send it to the server
** via HTTP or HTTPS. Get a reply, uncompress the reply, and store the reply
** in pRecv. pRecv is assumed to be uninitialized when
** this routine is called - this routine will initialize it.
**
** The server address is contain in the "g" global structure. The
** url_parse() routine should have been called prior to this routine
** in order to fill this structure appropriately.
*/
int http_exchange(Blob *pSend, Blob *pReply, int useLogin, int maxRedirect){
Blob login; /* The login card */
Blob payload; /* The complete payload including login card */
Blob hdr; /* The HTTP request header */
int closeConnection; /* True to close the connection when done */
int iLength; /* Length of the reply payload */
int rc = 0; /* Result code */
int iHttpVersion; /* Which version of HTTP protocol server uses */
|
| ︙ | ︙ | |||
243 244 245 246 247 248 249 |
c = zLine[i];
if( c=='c' || c=='C' ){
closeConnection = 1;
}else if( c=='k' || c=='K' ){
closeConnection = 0;
}
}else if( rc==302 && fossil_strnicmp(zLine, "location:", 9)==0 ){
| > | > < | | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
c = zLine[i];
if( c=='c' || c=='C' ){
closeConnection = 1;
}else if( c=='k' || c=='K' ){
closeConnection = 0;
}
}else if( rc==302 && fossil_strnicmp(zLine, "location:", 9)==0 ){
int i, j;
if ( --maxRedirect == 0){
fossil_fatal("redirect limit exceeded");
}
for(i=9; zLine[i] && zLine[i]==' '; i++){}
if( zLine[i]==0 ) fossil_fatal("malformed redirect: %s", zLine);
j = strlen(zLine) - 1;
while( j>4 && fossil_strcmp(&zLine[j-4],"/xfer")==0 ){
j -= 4;
zLine[j] = 0;
}
fossil_print("redirect to %s\n", &zLine[i]);
url_parse(&zLine[i]);
transport_close();
return http_exchange(pSend, pReply, useLogin, maxRedirect);
}else if( fossil_strnicmp(zLine, "content-type: ", 14)==0 ){
if( fossil_strnicmp(&zLine[14], "application/x-fossil-debug", -1)==0 ){
isCompressed = 0;
}else if( fossil_strnicmp(&zLine[14],
"application/x-fossil-uncompressed", -1)==0 ){
isCompressed = 0;
}else if( fossil_strnicmp(&zLine[14], "application/x-fossil", -1)!=0 ){
|
| ︙ | ︙ |
Changes to src/xfer.c.
| ︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
** This file contains code to implement the file transfer protocol.
*/
#include "config.h"
#include "xfer.h"
#include <time.h>
/*
** This structure holds information about the current state of either
** a client or a server that is participating in xfer.
*/
typedef struct Xfer Xfer;
struct Xfer {
Blob *pIn; /* Input text from the other side */
| > > > > > > | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
** This file contains code to implement the file transfer protocol.
*/
#include "config.h"
#include "xfer.h"
#include <time.h>
/*
** Maximum number of HTTP redirects that any http_exchange() call will
** follow before throwing a fatal error. Most browsers use a limit of 20.
*/
#define MAX_REDIRECTS 20
/*
** This structure holds information about the current state of either
** a client or a server that is participating in xfer.
*/
typedef struct Xfer Xfer;
struct Xfer {
Blob *pIn; /* Input text from the other side */
|
| ︙ | ︙ | |||
1478 1479 1480 1481 1482 1483 1484 |
xfer.nDeltaSent = 0;
xfer.nGimmeSent = 0;
xfer.nIGotSent = 0;
if( syncFlags & SYNC_VERBOSE ){
fossil_print("waiting for server...");
}
fflush(stdout);
| | > | 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 |
xfer.nDeltaSent = 0;
xfer.nGimmeSent = 0;
xfer.nIGotSent = 0;
if( syncFlags & SYNC_VERBOSE ){
fossil_print("waiting for server...");
}
fflush(stdout);
if( http_exchange(&send, &recv, (syncFlags & SYNC_CLONE)==0 || nCycle>0,
MAX_REDIRECTS) ){
nErr++;
break;
}
lastPctDone = -1;
blob_reset(&send);
rArrivalTime = db_double(0.0, "SELECT julianday('now')");
|
| ︙ | ︙ |