Support contacting archives search server over http
authorMagnus Hagander <magnus@hagander.net>
Mon, 5 Mar 2018 12:10:50 +0000 (13:10 +0100)
committerMagnus Hagander <magnus@hagander.net>
Mon, 5 Mar 2018 12:11:28 +0000 (13:11 +0100)
This makes it a lot easier to do local testing. Of course, in production
we use https and by default.

pgweb/search/views.py
pgweb/settings.py

index 4564fe469b580366ac6243d47c00119fea0248ed..fe0781237c593af72c23c54effbf6ad37bae8266 100644 (file)
@@ -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:
index 91a8bede8ec0c94b10a3390aeb84dbd638a68be9..ccbbe6d61198e9c206f93f2ce38782607e0aacd5 100644 (file)
@@ -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