Fossil SCM
Work toward getting and "update" or "commit" to continue even after an auto-sync failure.
Commit
9286aaf778c612745fa0804c4fdf8290b9036558
Parent
e5d99df4bc14883…
2 files changed
+8
-8
+3
-3
+8
-8
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -127,11 +127,11 @@ | ||
| 127 | 127 | ** |
| 128 | 128 | ** The server address is contain in the "g" global structure. The |
| 129 | 129 | ** url_parse() routine should have been called prior to this routine |
| 130 | 130 | ** in order to fill this structure appropriately. |
| 131 | 131 | */ |
| 132 | -void http_exchange(Blob *pSend, Blob *pReply, int useLogin){ | |
| 132 | +int http_exchange(Blob *pSend, Blob *pReply, int useLogin){ | |
| 133 | 133 | Blob login; /* The login card */ |
| 134 | 134 | Blob payload; /* The complete payload including login card */ |
| 135 | 135 | Blob hdr; /* The HTTP request header */ |
| 136 | 136 | int closeConnection; /* True to close the connection when done */ |
| 137 | 137 | int iLength; /* Length of the reply payload */ |
| @@ -140,11 +140,12 @@ | ||
| 140 | 140 | char *zLine; /* A single line of the reply header */ |
| 141 | 141 | int i; /* Loop counter */ |
| 142 | 142 | int isError = 0; /* True if the reply is an error message */ |
| 143 | 143 | |
| 144 | 144 | if( transport_open() ){ |
| 145 | - fossil_fatal(transport_errmsg()); | |
| 145 | + fossil_warning(transport_errmsg()); | |
| 146 | + return 1; | |
| 146 | 147 | } |
| 147 | 148 | |
| 148 | 149 | /* Construct the login card and prepare the complete payload */ |
| 149 | 150 | blob_zero(&login); |
| 150 | 151 | if( useLogin ) http_build_login_card(pSend, &login); |
| @@ -201,11 +202,11 @@ | ||
| 201 | 202 | if( sscanf(zLine, "HTTP/1.%d %d", &iHttpVersion, &rc)!=2 ) goto write_err; |
| 202 | 203 | if( rc!=200 && rc!=302 ){ |
| 203 | 204 | int ii; |
| 204 | 205 | for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){} |
| 205 | 206 | while( zLine[ii]==' ' ) ii++; |
| 206 | - fossil_fatal("server says: %s\n", &zLine[ii]); | |
| 207 | + fossil_warning("server says: %s", &zLine[ii]); | |
| 207 | 208 | goto write_err; |
| 208 | 209 | } |
| 209 | 210 | if( iHttpVersion==0 ){ |
| 210 | 211 | closeConnection = 1; |
| 211 | 212 | }else{ |
| @@ -233,18 +234,17 @@ | ||
| 233 | 234 | zLine[j] = 0; |
| 234 | 235 | } |
| 235 | 236 | fossil_print("redirect to %s\n", &zLine[i]); |
| 236 | 237 | url_parse(&zLine[i]); |
| 237 | 238 | transport_close(); |
| 238 | - http_exchange(pSend, pReply, useLogin); | |
| 239 | - return; | |
| 239 | + return http_exchange(pSend, pReply, useLogin); | |
| 240 | 240 | }else if( strncasecmp(zLine, "content-type: text/html", 23)==0 ){ |
| 241 | 241 | isError = 1; |
| 242 | 242 | } |
| 243 | 243 | } |
| 244 | 244 | if( rc!=200 ){ |
| 245 | - fossil_fatal("\"location:\" missing from 302 redirect reply"); | |
| 245 | + fossil_warning("\"location:\" missing from 302 redirect reply"); | |
| 246 | 246 | goto write_err; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /* |
| 250 | 250 | ** Extract the reply payload that follows the header |
| @@ -288,14 +288,14 @@ | ||
| 288 | 288 | if( closeConnection ){ |
| 289 | 289 | transport_close(); |
| 290 | 290 | }else{ |
| 291 | 291 | transport_rewind(); |
| 292 | 292 | } |
| 293 | - return; | |
| 293 | + return 0; | |
| 294 | 294 | |
| 295 | 295 | /* |
| 296 | 296 | ** Jump to here if an error is seen. |
| 297 | 297 | */ |
| 298 | 298 | write_err: |
| 299 | 299 | transport_close(); |
| 300 | - return; | |
| 300 | + return 1; | |
| 301 | 301 | } |
| 302 | 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 | 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 @@ | ||
| 322 | 322 | if( g.cgiOutput ){ |
| 323 | 323 | g.cgiOutput = 0; |
| 324 | 324 | cgi_printf("<p class=\"generalError\">%h</p>", z); |
| 325 | 325 | cgi_reply(); |
| 326 | 326 | }else{ |
| 327 | - fprintf(stderr, "%s: %s\n", fossil_nameofexe(), z); | |
| 327 | + fprintf(stderr, "\r%s: %s\n", fossil_nameofexe(), z); | |
| 328 | 328 | } |
| 329 | 329 | db_force_rollback(); |
| 330 | 330 | fossil_exit(1); |
| 331 | 331 | } |
| 332 | 332 | |
| @@ -350,11 +350,11 @@ | ||
| 350 | 350 | if( g.cgiOutput ){ |
| 351 | 351 | g.cgiOutput = 0; |
| 352 | 352 | cgi_printf("<p class=\"generalError\">%h</p>", z); |
| 353 | 353 | cgi_reply(); |
| 354 | 354 | }else{ |
| 355 | - fprintf(stderr, "%s: %s\n", fossil_nameofexe(), z); | |
| 355 | + fprintf(stderr, "\r%s: %s\n", fossil_nameofexe(), z); | |
| 356 | 356 | } |
| 357 | 357 | db_force_rollback(); |
| 358 | 358 | fossil_exit(1); |
| 359 | 359 | } |
| 360 | 360 | |
| @@ -367,11 +367,11 @@ | ||
| 367 | 367 | z = vmprintf(zFormat, ap); |
| 368 | 368 | va_end(ap); |
| 369 | 369 | if( g.cgiOutput ){ |
| 370 | 370 | cgi_printf("<p class=\"generalError\">%h</p>", z); |
| 371 | 371 | }else{ |
| 372 | - fprintf(stderr, "%s: %s\n", fossil_nameofexe(), z); | |
| 372 | + fprintf(stderr, "\r%s: %s\n", fossil_nameofexe(), z); | |
| 373 | 373 | } |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | /* |
| 377 | 377 | ** Malloc and free routines that cannot fail |
| 378 | 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, "%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 |