Fossil SCM

Work toward getting and "update" or "commit" to continue even after an auto-sync failure.

drh 2010-11-19 19:48 trunk
Commit 9286aaf778c612745fa0804c4fdf8290b9036558
2 files changed +8 -8 +3 -3
+8 -8
--- src/http.c
+++ src/http.c
@@ -127,11 +127,11 @@
127127
**
128128
** The server address is contain in the "g" global structure. The
129129
** url_parse() routine should have been called prior to this routine
130130
** in order to fill this structure appropriately.
131131
*/
132
-void http_exchange(Blob *pSend, Blob *pReply, int useLogin){
132
+int http_exchange(Blob *pSend, Blob *pReply, int useLogin){
133133
Blob login; /* The login card */
134134
Blob payload; /* The complete payload including login card */
135135
Blob hdr; /* The HTTP request header */
136136
int closeConnection; /* True to close the connection when done */
137137
int iLength; /* Length of the reply payload */
@@ -140,11 +140,12 @@
140140
char *zLine; /* A single line of the reply header */
141141
int i; /* Loop counter */
142142
int isError = 0; /* True if the reply is an error message */
143143
144144
if( transport_open() ){
145
- fossil_fatal(transport_errmsg());
145
+ fossil_warning(transport_errmsg());
146
+ return 1;
146147
}
147148
148149
/* Construct the login card and prepare the complete payload */
149150
blob_zero(&login);
150151
if( useLogin ) http_build_login_card(pSend, &login);
@@ -201,11 +202,11 @@
201202
if( sscanf(zLine, "HTTP/1.%d %d", &iHttpVersion, &rc)!=2 ) goto write_err;
202203
if( rc!=200 && rc!=302 ){
203204
int ii;
204205
for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
205206
while( zLine[ii]==' ' ) ii++;
206
- fossil_fatal("server says: %s\n", &zLine[ii]);
207
+ fossil_warning("server says: %s", &zLine[ii]);
207208
goto write_err;
208209
}
209210
if( iHttpVersion==0 ){
210211
closeConnection = 1;
211212
}else{
@@ -233,18 +234,17 @@
233234
zLine[j] = 0;
234235
}
235236
fossil_print("redirect to %s\n", &zLine[i]);
236237
url_parse(&zLine[i]);
237238
transport_close();
238
- http_exchange(pSend, pReply, useLogin);
239
- return;
239
+ return http_exchange(pSend, pReply, useLogin);
240240
}else if( strncasecmp(zLine, "content-type: text/html", 23)==0 ){
241241
isError = 1;
242242
}
243243
}
244244
if( rc!=200 ){
245
- fossil_fatal("\"location:\" missing from 302 redirect reply");
245
+ fossil_warning("\"location:\" missing from 302 redirect reply");
246246
goto write_err;
247247
}
248248
249249
/*
250250
** Extract the reply payload that follows the header
@@ -288,14 +288,14 @@
288288
if( closeConnection ){
289289
transport_close();
290290
}else{
291291
transport_rewind();
292292
}
293
- return;
293
+ return 0;
294294
295295
/*
296296
** Jump to here if an error is seen.
297297
*/
298298
write_err:
299299
transport_close();
300
- return;
300
+ return 1;
301301
}
302302
--- src/http.c
+++ src/http.c
@@ -127,11 +127,11 @@
127 **
128 ** The server address is contain in the "g" global structure. The
129 ** url_parse() routine should have been called prior to this routine
130 ** in order to fill this structure appropriately.
131 */
132 void http_exchange(Blob *pSend, Blob *pReply, int useLogin){
133 Blob login; /* The login card */
134 Blob payload; /* The complete payload including login card */
135 Blob hdr; /* The HTTP request header */
136 int closeConnection; /* True to close the connection when done */
137 int iLength; /* Length of the reply payload */
@@ -140,11 +140,12 @@
140 char *zLine; /* A single line of the reply header */
141 int i; /* Loop counter */
142 int isError = 0; /* True if the reply is an error message */
143
144 if( transport_open() ){
145 fossil_fatal(transport_errmsg());
 
146 }
147
148 /* Construct the login card and prepare the complete payload */
149 blob_zero(&login);
150 if( useLogin ) http_build_login_card(pSend, &login);
@@ -201,11 +202,11 @@
201 if( sscanf(zLine, "HTTP/1.%d %d", &iHttpVersion, &rc)!=2 ) goto write_err;
202 if( rc!=200 && rc!=302 ){
203 int ii;
204 for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
205 while( zLine[ii]==' ' ) ii++;
206 fossil_fatal("server says: %s\n", &zLine[ii]);
207 goto write_err;
208 }
209 if( iHttpVersion==0 ){
210 closeConnection = 1;
211 }else{
@@ -233,18 +234,17 @@
233 zLine[j] = 0;
234 }
235 fossil_print("redirect to %s\n", &zLine[i]);
236 url_parse(&zLine[i]);
237 transport_close();
238 http_exchange(pSend, pReply, useLogin);
239 return;
240 }else if( strncasecmp(zLine, "content-type: text/html", 23)==0 ){
241 isError = 1;
242 }
243 }
244 if( rc!=200 ){
245 fossil_fatal("\"location:\" missing from 302 redirect reply");
246 goto write_err;
247 }
248
249 /*
250 ** Extract the reply payload that follows the header
@@ -288,14 +288,14 @@
288 if( closeConnection ){
289 transport_close();
290 }else{
291 transport_rewind();
292 }
293 return;
294
295 /*
296 ** Jump to here if an error is seen.
297 */
298 write_err:
299 transport_close();
300 return;
301 }
302
--- src/http.c
+++ src/http.c
@@ -127,11 +127,11 @@
127 **
128 ** The server address is contain in the "g" global structure. The
129 ** url_parse() routine should have been called prior to this routine
130 ** in order to fill this structure appropriately.
131 */
132 int http_exchange(Blob *pSend, Blob *pReply, int useLogin){
133 Blob login; /* The login card */
134 Blob payload; /* The complete payload including login card */
135 Blob hdr; /* The HTTP request header */
136 int closeConnection; /* True to close the connection when done */
137 int iLength; /* Length of the reply payload */
@@ -140,11 +140,12 @@
140 char *zLine; /* A single line of the reply header */
141 int i; /* Loop counter */
142 int isError = 0; /* True if the reply is an error message */
143
144 if( transport_open() ){
145 fossil_warning(transport_errmsg());
146 return 1;
147 }
148
149 /* Construct the login card and prepare the complete payload */
150 blob_zero(&login);
151 if( useLogin ) http_build_login_card(pSend, &login);
@@ -201,11 +202,11 @@
202 if( sscanf(zLine, "HTTP/1.%d %d", &iHttpVersion, &rc)!=2 ) goto write_err;
203 if( rc!=200 && rc!=302 ){
204 int ii;
205 for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
206 while( zLine[ii]==' ' ) ii++;
207 fossil_warning("server says: %s", &zLine[ii]);
208 goto write_err;
209 }
210 if( iHttpVersion==0 ){
211 closeConnection = 1;
212 }else{
@@ -233,18 +234,17 @@
234 zLine[j] = 0;
235 }
236 fossil_print("redirect to %s\n", &zLine[i]);
237 url_parse(&zLine[i]);
238 transport_close();
239 return http_exchange(pSend, pReply, useLogin);
 
240 }else if( strncasecmp(zLine, "content-type: text/html", 23)==0 ){
241 isError = 1;
242 }
243 }
244 if( rc!=200 ){
245 fossil_warning("\"location:\" missing from 302 redirect reply");
246 goto write_err;
247 }
248
249 /*
250 ** Extract the reply payload that follows the header
@@ -288,14 +288,14 @@
288 if( closeConnection ){
289 transport_close();
290 }else{
291 transport_rewind();
292 }
293 return 0;
294
295 /*
296 ** Jump to here if an error is seen.
297 */
298 write_err:
299 transport_close();
300 return 1;
301 }
302
+3 -3
--- src/main.c
+++ src/main.c
@@ -322,11 +322,11 @@
322322
if( g.cgiOutput ){
323323
g.cgiOutput = 0;
324324
cgi_printf("<p class=\"generalError\">%h</p>", z);
325325
cgi_reply();
326326
}else{
327
- fprintf(stderr, "%s: %s\n", fossil_nameofexe(), z);
327
+ fprintf(stderr, "\r%s: %s\n", fossil_nameofexe(), z);
328328
}
329329
db_force_rollback();
330330
fossil_exit(1);
331331
}
332332
@@ -350,11 +350,11 @@
350350
if( g.cgiOutput ){
351351
g.cgiOutput = 0;
352352
cgi_printf("<p class=\"generalError\">%h</p>", z);
353353
cgi_reply();
354354
}else{
355
- fprintf(stderr, "%s: %s\n", fossil_nameofexe(), z);
355
+ fprintf(stderr, "\r%s: %s\n", fossil_nameofexe(), z);
356356
}
357357
db_force_rollback();
358358
fossil_exit(1);
359359
}
360360
@@ -367,11 +367,11 @@
367367
z = vmprintf(zFormat, ap);
368368
va_end(ap);
369369
if( g.cgiOutput ){
370370
cgi_printf("<p class=\"generalError\">%h</p>", z);
371371
}else{
372
- fprintf(stderr, "%s: %s\n", fossil_nameofexe(), z);
372
+ fprintf(stderr, "\r%s: %s\n", fossil_nameofexe(), z);
373373
}
374374
}
375375
376376
/*
377377
** Malloc and free routines that cannot fail
378378
--- src/main.c
+++ src/main.c
@@ -322,11 +322,11 @@
322 if( g.cgiOutput ){
323 g.cgiOutput = 0;
324 cgi_printf("<p class=\"generalError\">%h</p>", z);
325 cgi_reply();
326 }else{
327 fprintf(stderr, "%s: %s\n", fossil_nameofexe(), z);
328 }
329 db_force_rollback();
330 fossil_exit(1);
331 }
332
@@ -350,11 +350,11 @@
350 if( g.cgiOutput ){
351 g.cgiOutput = 0;
352 cgi_printf("<p class=\"generalError\">%h</p>", z);
353 cgi_reply();
354 }else{
355 fprintf(stderr, "%s: %s\n", fossil_nameofexe(), z);
356 }
357 db_force_rollback();
358 fossil_exit(1);
359 }
360
@@ -367,11 +367,11 @@
367 z = vmprintf(zFormat, ap);
368 va_end(ap);
369 if( g.cgiOutput ){
370 cgi_printf("<p class=\"generalError\">%h</p>", z);
371 }else{
372 fprintf(stderr, "%s: %s\n", fossil_nameofexe(), z);
373 }
374 }
375
376 /*
377 ** Malloc and free routines that cannot fail
378
--- src/main.c
+++ src/main.c
@@ -322,11 +322,11 @@
322 if( g.cgiOutput ){
323 g.cgiOutput = 0;
324 cgi_printf("<p class=\"generalError\">%h</p>", z);
325 cgi_reply();
326 }else{
327 fprintf(stderr, "\r%s: %s\n", fossil_nameofexe(), z);
328 }
329 db_force_rollback();
330 fossil_exit(1);
331 }
332
@@ -350,11 +350,11 @@
350 if( g.cgiOutput ){
351 g.cgiOutput = 0;
352 cgi_printf("<p class=\"generalError\">%h</p>", z);
353 cgi_reply();
354 }else{
355 fprintf(stderr, "\r%s: %s\n", fossil_nameofexe(), z);
356 }
357 db_force_rollback();
358 fossil_exit(1);
359 }
360
@@ -367,11 +367,11 @@
367 z = vmprintf(zFormat, ap);
368 va_end(ap);
369 if( g.cgiOutput ){
370 cgi_printf("<p class=\"generalError\">%h</p>", z);
371 }else{
372 fprintf(stderr, "\r%s: %s\n", fossil_nameofexe(), z);
373 }
374 }
375
376 /*
377 ** Malloc and free routines that cannot fail
378

Keyboard Shortcuts

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