git » blitiri » commit 087b11d

Use https in links by default

author Leandro Lucarella
2022-08-20 19:12:52 UTC
committer Alberto Bertogli
2022-08-20 19:30:39 UTC
parent b1902b12f2eef0d0134e7c89c609cbfad1eed1a6

Use https in links by default

blitiri.cgi +6 -5

diff --git a/blitiri.cgi b/blitiri.cgi
index 4da3660..a842d0e 100755
--- a/blitiri.cgi
+++ b/blitiri.cgi
@@ -548,7 +548,7 @@ def valid_link(link):
 	if re.match(mail_re, link, re.I):
 		return 'mailto:' + link
 	elif re.match(url_re, link, re.I):
-		return 'http://' + link
+		return 'https://' + link
 
 	return None
 
@@ -559,11 +559,12 @@ def sanitize(obj):
 # find out our URL, needed for syndication
 try:
 	n = os.environ['SERVER_NAME']
-	p = os.environ['SERVER_PORT']
+        # Removed port because it messes up when behind a proxy
+	#p = os.environ['SERVER_PORT']
 	s = os.environ['SCRIPT_NAME']
-	if p == '80': p = ''
-	else: p = ':' + p
-	full_url = 'http://%s%s%s' % (n, p, s)
+	#if p == '80': p = ''
+	#else: p = ':' + p
+	full_url = 'https://%s%s' % (n, s)
 except KeyError:
 	full_url = 'Not needed'