From d37b7396ffda779c3a0b45d656a1d5035aaba7de Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Mon, 5 Mar 2018 13:10:50 +0100 Subject: [PATCH] Support contacting archives search server over http This makes it a lot easier to do local testing. Of course, in production we use https and by default. --- pgweb/search/views.py | 5 ++++- pgweb/settings.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pgweb/search/views.py b/pgweb/search/views.py index 4564fe46..fe078123 100644 --- a/pgweb/search/views.py +++ b/pgweb/search/views.py @@ -190,7 +190,10 @@ def search(request): memc = None if not hits: # No hits found - so try to get them from the search server - c = httplib.HTTPSConnection(settings.ARCHIVES_SEARCH_SERVER, strict=True, timeout=5) + if settings.ARCHIVES_SEARCH_PLAINTEXT: + c = httplib.HTTPConnection(settings.ARCHIVES_SEARCH_SERVER, strict=True, timeout=5) + else: + c = httplib.HTTPSConnection(settings.ARCHIVES_SEARCH_SERVER, strict=True, timeout=5) c.request('POST', '/archives-search/', urlstr, {'Content-type': 'application/x-www-form-urlencoded; charset=utf-8'}) c.sock.settimeout(20) # Set a 20 second timeout try: diff --git a/pgweb/settings.py b/pgweb/settings.py index 91a8bede..ccbbe6d6 100644 --- a/pgweb/settings.py +++ b/pgweb/settings.py @@ -158,6 +158,7 @@ FTP_MASTERS=() # A tuple containing the *IP addresses* of all machin VARNISH_PURGERS=() # Extra servers that can do varnish purges through our queue LIST_ACTIVATORS=() # Servers that can activate lists ARCHIVES_SEARCH_SERVER="archives.postgresql.org" # Where to post REST request for archives search +ARCHIVES_SEARCH_PLAINTEXT=False # Contact ARCHIVES_SEARCH_SERVER with http instead of https FRONTEND_SMTP_RELAY="magus.postgresql.org" # Where to relay user generated email OAUTH={} # OAuth providers and keys PGDG_ORG_ID=-1 # id of the PGDG organisation entry -- 2.39.5