Ver código fonte

[enh] https support @ opensearch.xml

asciimoo 11 anos atrás
pai
commit
d1e8c2365e
1 arquivos alterados com 4 adições e 1 exclusões
  1. 4
    1
      searx/webapp.py

+ 4
- 1
searx/webapp.py Ver arquivo

115
 def opensearch():
115
 def opensearch():
116
     global opensearch_xml
116
     global opensearch_xml
117
     method = 'post'
117
     method = 'post'
118
+    scheme = 'http'
118
     # chrome/chromium only supports HTTP GET....
119
     # chrome/chromium only supports HTTP GET....
119
     if request.headers.get('User-Agent', '').lower().find('webkit') >= 0:
120
     if request.headers.get('User-Agent', '').lower().find('webkit') >= 0:
120
         method = 'get'
121
         method = 'get'
121
-    ret = opensearch_xml.format(method=method, host=url_for('index', _external=True))
122
+    if request.headers.get('Host', '').find('https://'):
123
+        scheme = 'https'
124
+    ret = opensearch_xml.format(method=method, host=url_for('index', _external=True, _scheme=scheme))
122
     resp = Response(response=ret,
125
     resp = Response(response=ret,
123
                 status=200,
126
                 status=200,
124
                 mimetype="application/xml")
127
                 mimetype="application/xml")