Fossil SCM

In http_exchange(), set the proxy up again after following a redirect, so that the request to the new location also goes through the proxy.

dmestas 2026-11-22 11:36 UTC small-fixes
Commit d9cd6aa143cebba9e577a49bb53f23a52a192554c025b460d31edc118fae3caf
1 file changed +3
+3
--- src/http.c
+++ src/http.c
@@ -723,10 +723,11 @@
723723
}
724724
}else if( ( rc==301 || rc==302 || rc==307 || rc==308 ) &&
725725
fossil_strnicmp(zLine, "location:", 9)==0 ){
726726
int i, j;
727727
int wasHttps;
728
+ int wasProxy;
728729
int priorUrlFlags;
729730
730731
if ( --maxRedirect == 0){
731732
if( (mHttpFlags & HTTP_QUIET)==0 ){
732733
fossil_warning("redirect limit exceeded");
@@ -752,10 +753,11 @@
752753
&zLine[i]);
753754
}
754755
goto write_err;
755756
}
756757
wasHttps = g.url.isHttps;
758
+ wasProxy = g.url.useProxy;
757759
priorUrlFlags = g.url.flags;
758760
url_parse(&zLine[i], 0);
759761
if( wasHttps && !g.url.isHttps ){
760762
if( (mHttpFlags & HTTP_QUIET)==0 ){
761763
fossil_warning("cannot redirect from HTTPS to HTTP");
@@ -775,10 +777,11 @@
775777
g.zHttpAuth = get_httpauth();
776778
if( (rc==301 || rc==308) && (priorUrlFlags & URL_REMEMBER)!=0 ){
777779
g.url.flags |= URL_REMEMBER;
778780
url_remember();
779781
}
782
+ if( wasProxy ) url_enable_proxy(0);
780783
return http_exchange(pSend, pReply, mHttpFlags,
781784
maxRedirect, zAltMimetype);
782785
}else if( fossil_strnicmp(zLine, "content-type: ", 14)==0 ){
783786
if( fossil_strnicmp(&zLine[14], "application/x-fossil-debug", -1)==0 ){
784787
isCompressed = 0;
785788
--- src/http.c
+++ src/http.c
@@ -723,10 +723,11 @@
723 }
724 }else if( ( rc==301 || rc==302 || rc==307 || rc==308 ) &&
725 fossil_strnicmp(zLine, "location:", 9)==0 ){
726 int i, j;
727 int wasHttps;
 
728 int priorUrlFlags;
729
730 if ( --maxRedirect == 0){
731 if( (mHttpFlags & HTTP_QUIET)==0 ){
732 fossil_warning("redirect limit exceeded");
@@ -752,10 +753,11 @@
752 &zLine[i]);
753 }
754 goto write_err;
755 }
756 wasHttps = g.url.isHttps;
 
757 priorUrlFlags = g.url.flags;
758 url_parse(&zLine[i], 0);
759 if( wasHttps && !g.url.isHttps ){
760 if( (mHttpFlags & HTTP_QUIET)==0 ){
761 fossil_warning("cannot redirect from HTTPS to HTTP");
@@ -775,10 +777,11 @@
775 g.zHttpAuth = get_httpauth();
776 if( (rc==301 || rc==308) && (priorUrlFlags & URL_REMEMBER)!=0 ){
777 g.url.flags |= URL_REMEMBER;
778 url_remember();
779 }
 
780 return http_exchange(pSend, pReply, mHttpFlags,
781 maxRedirect, zAltMimetype);
782 }else if( fossil_strnicmp(zLine, "content-type: ", 14)==0 ){
783 if( fossil_strnicmp(&zLine[14], "application/x-fossil-debug", -1)==0 ){
784 isCompressed = 0;
785
--- src/http.c
+++ src/http.c
@@ -723,10 +723,11 @@
723 }
724 }else if( ( rc==301 || rc==302 || rc==307 || rc==308 ) &&
725 fossil_strnicmp(zLine, "location:", 9)==0 ){
726 int i, j;
727 int wasHttps;
728 int wasProxy;
729 int priorUrlFlags;
730
731 if ( --maxRedirect == 0){
732 if( (mHttpFlags & HTTP_QUIET)==0 ){
733 fossil_warning("redirect limit exceeded");
@@ -752,10 +753,11 @@
753 &zLine[i]);
754 }
755 goto write_err;
756 }
757 wasHttps = g.url.isHttps;
758 wasProxy = g.url.useProxy;
759 priorUrlFlags = g.url.flags;
760 url_parse(&zLine[i], 0);
761 if( wasHttps && !g.url.isHttps ){
762 if( (mHttpFlags & HTTP_QUIET)==0 ){
763 fossil_warning("cannot redirect from HTTPS to HTTP");
@@ -775,10 +777,11 @@
777 g.zHttpAuth = get_httpauth();
778 if( (rc==301 || rc==308) && (priorUrlFlags & URL_REMEMBER)!=0 ){
779 g.url.flags |= URL_REMEMBER;
780 url_remember();
781 }
782 if( wasProxy ) url_enable_proxy(0);
783 return http_exchange(pSend, pReply, mHttpFlags,
784 maxRedirect, zAltMimetype);
785 }else if( fossil_strnicmp(zLine, "content-type: ", 14)==0 ){
786 if( fossil_strnicmp(&zLine[14], "application/x-fossil-debug", -1)==0 ){
787 isCompressed = 0;
788

Keyboard Shortcuts

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