Fossil SCM
Fix a bug that preventing a redirect on sync from remembering the new URL. [forum:/forumpost/ea4b2ec3fe577e79|Forum post ea4b2ec3].
Commit
754e2c1b6e8e56a5cadee8f779dc05c5f6ca932280dcc7bb53c13c5d348341df
Parent
136dbe9ce0fbd46…
1 file changed
+6
-1
+6
-1
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -575,10 +575,11 @@ | ||
| 575 | 575 | } |
| 576 | 576 | }else if( ( rc==301 || rc==302 || rc==307 || rc==308 ) && |
| 577 | 577 | fossil_strnicmp(zLine, "location:", 9)==0 ){ |
| 578 | 578 | int i, j; |
| 579 | 579 | int wasHttps; |
| 580 | + int priorUrlFlags; | |
| 580 | 581 | |
| 581 | 582 | if ( --maxRedirect == 0){ |
| 582 | 583 | fossil_warning("redirect limit exceeded"); |
| 583 | 584 | goto write_err; |
| 584 | 585 | } |
| @@ -599,10 +600,11 @@ | ||
| 599 | 600 | fossil_warning("cannot redirect from %s to %s", g.url.canonical, |
| 600 | 601 | &zLine[i]); |
| 601 | 602 | goto write_err; |
| 602 | 603 | } |
| 603 | 604 | wasHttps = g.url.isHttps; |
| 605 | + priorUrlFlags = g.url.flags; | |
| 604 | 606 | url_parse(&zLine[i], 0); |
| 605 | 607 | if( wasHttps && !g.url.isHttps ){ |
| 606 | 608 | fossil_warning("cannot redirect from HTTPS to HTTP"); |
| 607 | 609 | goto write_err; |
| 608 | 610 | } |
| @@ -613,11 +615,14 @@ | ||
| 613 | 615 | transport_close(&g.url); |
| 614 | 616 | transport_global_shutdown(&g.url); |
| 615 | 617 | fSeenHttpAuth = 0; |
| 616 | 618 | if( g.zHttpAuth ) free(g.zHttpAuth); |
| 617 | 619 | g.zHttpAuth = get_httpauth(); |
| 618 | - if( rc==301 || rc==308 ) url_remember(); | |
| 620 | + if( (rc==301 || rc==308) && (priorUrlFlags & URL_REMEMBER)!=0 ){ | |
| 621 | + g.url.flags |= URL_REMEMBER; | |
| 622 | + url_remember(); | |
| 623 | + } | |
| 619 | 624 | return http_exchange(pSend, pReply, mHttpFlags, |
| 620 | 625 | maxRedirect, zAltMimetype); |
| 621 | 626 | }else if( fossil_strnicmp(zLine, "content-type: ", 14)==0 ){ |
| 622 | 627 | if( fossil_strnicmp(&zLine[14], "application/x-fossil-debug", -1)==0 ){ |
| 623 | 628 | isCompressed = 0; |
| 624 | 629 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -575,10 +575,11 @@ | |
| 575 | } |
| 576 | }else if( ( rc==301 || rc==302 || rc==307 || rc==308 ) && |
| 577 | fossil_strnicmp(zLine, "location:", 9)==0 ){ |
| 578 | int i, j; |
| 579 | int wasHttps; |
| 580 | |
| 581 | if ( --maxRedirect == 0){ |
| 582 | fossil_warning("redirect limit exceeded"); |
| 583 | goto write_err; |
| 584 | } |
| @@ -599,10 +600,11 @@ | |
| 599 | fossil_warning("cannot redirect from %s to %s", g.url.canonical, |
| 600 | &zLine[i]); |
| 601 | goto write_err; |
| 602 | } |
| 603 | wasHttps = g.url.isHttps; |
| 604 | url_parse(&zLine[i], 0); |
| 605 | if( wasHttps && !g.url.isHttps ){ |
| 606 | fossil_warning("cannot redirect from HTTPS to HTTP"); |
| 607 | goto write_err; |
| 608 | } |
| @@ -613,11 +615,14 @@ | |
| 613 | transport_close(&g.url); |
| 614 | transport_global_shutdown(&g.url); |
| 615 | fSeenHttpAuth = 0; |
| 616 | if( g.zHttpAuth ) free(g.zHttpAuth); |
| 617 | g.zHttpAuth = get_httpauth(); |
| 618 | if( rc==301 || rc==308 ) url_remember(); |
| 619 | return http_exchange(pSend, pReply, mHttpFlags, |
| 620 | maxRedirect, zAltMimetype); |
| 621 | }else if( fossil_strnicmp(zLine, "content-type: ", 14)==0 ){ |
| 622 | if( fossil_strnicmp(&zLine[14], "application/x-fossil-debug", -1)==0 ){ |
| 623 | isCompressed = 0; |
| 624 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -575,10 +575,11 @@ | |
| 575 | } |
| 576 | }else if( ( rc==301 || rc==302 || rc==307 || rc==308 ) && |
| 577 | fossil_strnicmp(zLine, "location:", 9)==0 ){ |
| 578 | int i, j; |
| 579 | int wasHttps; |
| 580 | int priorUrlFlags; |
| 581 | |
| 582 | if ( --maxRedirect == 0){ |
| 583 | fossil_warning("redirect limit exceeded"); |
| 584 | goto write_err; |
| 585 | } |
| @@ -599,10 +600,11 @@ | |
| 600 | fossil_warning("cannot redirect from %s to %s", g.url.canonical, |
| 601 | &zLine[i]); |
| 602 | goto write_err; |
| 603 | } |
| 604 | wasHttps = g.url.isHttps; |
| 605 | priorUrlFlags = g.url.flags; |
| 606 | url_parse(&zLine[i], 0); |
| 607 | if( wasHttps && !g.url.isHttps ){ |
| 608 | fossil_warning("cannot redirect from HTTPS to HTTP"); |
| 609 | goto write_err; |
| 610 | } |
| @@ -613,11 +615,14 @@ | |
| 615 | transport_close(&g.url); |
| 616 | transport_global_shutdown(&g.url); |
| 617 | fSeenHttpAuth = 0; |
| 618 | if( g.zHttpAuth ) free(g.zHttpAuth); |
| 619 | g.zHttpAuth = get_httpauth(); |
| 620 | if( (rc==301 || rc==308) && (priorUrlFlags & URL_REMEMBER)!=0 ){ |
| 621 | g.url.flags |= URL_REMEMBER; |
| 622 | url_remember(); |
| 623 | } |
| 624 | return http_exchange(pSend, pReply, mHttpFlags, |
| 625 | maxRedirect, zAltMimetype); |
| 626 | }else if( fossil_strnicmp(zLine, "content-type: ", 14)==0 ){ |
| 627 | if( fossil_strnicmp(&zLine[14], "application/x-fossil-debug", -1)==0 ){ |
| 628 | isCompressed = 0; |
| 629 |