浏览代码

[enh] https support @ opensearch.xml

asciimoo 11 年前
父节点
当前提交
d1e8c2365e
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4
    1
      searx/webapp.py

+ 4
- 1
searx/webapp.py 查看文件

@@ -115,10 +115,13 @@ def stats():
115 115
 def opensearch():
116 116
     global opensearch_xml
117 117
     method = 'post'
118
+    scheme = 'http'
118 119
     # chrome/chromium only supports HTTP GET....
119 120
     if request.headers.get('User-Agent', '').lower().find('webkit') >= 0:
120 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 125
     resp = Response(response=ret,
123 126
                 status=200,
124 127
                 mimetype="application/xml")