Fossil SCM
Do not attempt to detect redirect loops. The client side will do that for us.
Commit
810842f18fffe83f9c1e3928dd03382aaac156647e668376fdd380ac707336bb
Parent
4aba9ea6fe949ea…
1 file changed
+2
-17
+2
-17
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -1359,29 +1359,14 @@ | ||
| 1359 | 1359 | */ |
| 1360 | 1360 | int fossil_redirect_to_https_if_needed(int iLevel){ |
| 1361 | 1361 | if( fossil_wants_https(iLevel) ){ |
| 1362 | 1362 | const char *zQS = P("QUERY_STRING"); |
| 1363 | 1363 | char *zURL; |
| 1364 | - if( P("redir")!=0 ){ | |
| 1365 | - style_header("Insecure Connection"); | |
| 1366 | - @ <h1>Unable To Establish An Encrypted Connection</h1> | |
| 1367 | - @ <p>This website requires an encrypted connection. | |
| 1368 | - @ The current connection is not encrypted | |
| 1369 | - @ across the entire route between your browser and the server. | |
| 1370 | - @ An attempt was made to redirect to %h(g.zHttpsURL) but | |
| 1371 | - @ the connection is still insecure even after the redirect.</p> | |
| 1372 | - @ <p>This is probably some kind of configuration problem. Please | |
| 1373 | - @ contact your sysadmin.</p> | |
| 1374 | - @ <p>Sorry it did not work out.</p> | |
| 1375 | - style_footer(); | |
| 1376 | - cgi_reply(); | |
| 1377 | - return 1; | |
| 1378 | - } | |
| 1379 | 1364 | if( zQS==0 || zQS[0]==0 ){ |
| 1380 | - zURL = mprintf("%s%T?redir=1", g.zHttpsURL, P("PATH_INFO")); | |
| 1365 | + zURL = mprintf("%s%T", g.zHttpsURL, P("PATH_INFO")); | |
| 1381 | 1366 | }else if( zQS[0]!=0 ){ |
| 1382 | - zURL = mprintf("%s%T?%s&redir=1", g.zHttpsURL, P("PATH_INFO"), zQS); | |
| 1367 | + zURL = mprintf("%s%T?%s", g.zHttpsURL, P("PATH_INFO"), zQS); | |
| 1383 | 1368 | } |
| 1384 | 1369 | cgi_redirect_with_status(zURL, 301, "Moved Permanently"); |
| 1385 | 1370 | return 1; |
| 1386 | 1371 | } |
| 1387 | 1372 | return 0; |
| 1388 | 1373 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -1359,29 +1359,14 @@ | |
| 1359 | */ |
| 1360 | int fossil_redirect_to_https_if_needed(int iLevel){ |
| 1361 | if( fossil_wants_https(iLevel) ){ |
| 1362 | const char *zQS = P("QUERY_STRING"); |
| 1363 | char *zURL; |
| 1364 | if( P("redir")!=0 ){ |
| 1365 | style_header("Insecure Connection"); |
| 1366 | @ <h1>Unable To Establish An Encrypted Connection</h1> |
| 1367 | @ <p>This website requires an encrypted connection. |
| 1368 | @ The current connection is not encrypted |
| 1369 | @ across the entire route between your browser and the server. |
| 1370 | @ An attempt was made to redirect to %h(g.zHttpsURL) but |
| 1371 | @ the connection is still insecure even after the redirect.</p> |
| 1372 | @ <p>This is probably some kind of configuration problem. Please |
| 1373 | @ contact your sysadmin.</p> |
| 1374 | @ <p>Sorry it did not work out.</p> |
| 1375 | style_footer(); |
| 1376 | cgi_reply(); |
| 1377 | return 1; |
| 1378 | } |
| 1379 | if( zQS==0 || zQS[0]==0 ){ |
| 1380 | zURL = mprintf("%s%T?redir=1", g.zHttpsURL, P("PATH_INFO")); |
| 1381 | }else if( zQS[0]!=0 ){ |
| 1382 | zURL = mprintf("%s%T?%s&redir=1", g.zHttpsURL, P("PATH_INFO"), zQS); |
| 1383 | } |
| 1384 | cgi_redirect_with_status(zURL, 301, "Moved Permanently"); |
| 1385 | return 1; |
| 1386 | } |
| 1387 | return 0; |
| 1388 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -1359,29 +1359,14 @@ | |
| 1359 | */ |
| 1360 | int fossil_redirect_to_https_if_needed(int iLevel){ |
| 1361 | if( fossil_wants_https(iLevel) ){ |
| 1362 | const char *zQS = P("QUERY_STRING"); |
| 1363 | char *zURL; |
| 1364 | if( zQS==0 || zQS[0]==0 ){ |
| 1365 | zURL = mprintf("%s%T", g.zHttpsURL, P("PATH_INFO")); |
| 1366 | }else if( zQS[0]!=0 ){ |
| 1367 | zURL = mprintf("%s%T?%s", g.zHttpsURL, P("PATH_INFO"), zQS); |
| 1368 | } |
| 1369 | cgi_redirect_with_status(zURL, 301, "Moved Permanently"); |
| 1370 | return 1; |
| 1371 | } |
| 1372 | return 0; |
| 1373 |