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.
Commit
d9cd6aa143cebba9e577a49bb53f23a52a192554c025b460d31edc118fae3caf
Parent
d71dee530e0af14…
1 file changed
+3
+3
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -723,10 +723,11 @@ | ||
| 723 | 723 | } |
| 724 | 724 | }else if( ( rc==301 || rc==302 || rc==307 || rc==308 ) && |
| 725 | 725 | fossil_strnicmp(zLine, "location:", 9)==0 ){ |
| 726 | 726 | int i, j; |
| 727 | 727 | int wasHttps; |
| 728 | + int wasProxy; | |
| 728 | 729 | int priorUrlFlags; |
| 729 | 730 | |
| 730 | 731 | if ( --maxRedirect == 0){ |
| 731 | 732 | if( (mHttpFlags & HTTP_QUIET)==0 ){ |
| 732 | 733 | fossil_warning("redirect limit exceeded"); |
| @@ -752,10 +753,11 @@ | ||
| 752 | 753 | &zLine[i]); |
| 753 | 754 | } |
| 754 | 755 | goto write_err; |
| 755 | 756 | } |
| 756 | 757 | wasHttps = g.url.isHttps; |
| 758 | + wasProxy = g.url.useProxy; | |
| 757 | 759 | priorUrlFlags = g.url.flags; |
| 758 | 760 | url_parse(&zLine[i], 0); |
| 759 | 761 | if( wasHttps && !g.url.isHttps ){ |
| 760 | 762 | if( (mHttpFlags & HTTP_QUIET)==0 ){ |
| 761 | 763 | fossil_warning("cannot redirect from HTTPS to HTTP"); |
| @@ -775,10 +777,11 @@ | ||
| 775 | 777 | g.zHttpAuth = get_httpauth(); |
| 776 | 778 | if( (rc==301 || rc==308) && (priorUrlFlags & URL_REMEMBER)!=0 ){ |
| 777 | 779 | g.url.flags |= URL_REMEMBER; |
| 778 | 780 | url_remember(); |
| 779 | 781 | } |
| 782 | + if( wasProxy ) url_enable_proxy(0); | |
| 780 | 783 | return http_exchange(pSend, pReply, mHttpFlags, |
| 781 | 784 | maxRedirect, zAltMimetype); |
| 782 | 785 | }else if( fossil_strnicmp(zLine, "content-type: ", 14)==0 ){ |
| 783 | 786 | if( fossil_strnicmp(&zLine[14], "application/x-fossil-debug", -1)==0 ){ |
| 784 | 787 | isCompressed = 0; |
| 785 | 788 |
| --- 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 |