浏览代码

[fix] unicode url proxiing

Adam Tauber 8 年前
父节点
当前提交
d5c0dcd18a
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2
    2
      searx/webapp.py

+ 2
- 2
searx/webapp.py 查看文件

250
     if not settings.get('result_proxy'):
250
     if not settings.get('result_proxy'):
251
         return url
251
         return url
252
 
252
 
253
-    h = hmac.new(settings['result_proxy']['key'], url, hashlib.sha256).hexdigest()
253
+    h = hmac.new(settings['result_proxy']['key'], url.encode('utf-8'), hashlib.sha256).hexdigest()
254
 
254
 
255
     return '{0}?{1}'.format(settings['result_proxy']['url'],
255
     return '{0}?{1}'.format(settings['result_proxy']['url'],
256
                             urlencode(dict(mortyurl=url.encode('utf-8'),
256
                             urlencode(dict(mortyurl=url.encode('utf-8'),
265
     if not request.preferences.get_value('image_proxy'):
265
     if not request.preferences.get_value('image_proxy'):
266
         return url
266
         return url
267
 
267
 
268
-    h = hmac.new(settings['server']['secret_key'], url, hashlib.sha256).hexdigest()
268
+    h = hmac.new(settings['server']['secret_key'], url.encode('utf-8'), hashlib.sha256).hexdigest()
269
 
269
 
270
     return '{0}?{1}'.format(url_for('image_proxy'),
270
     return '{0}?{1}'.format(url_for('image_proxy'),
271
                             urlencode(dict(url=url.encode('utf-8'), h=h)))
271
                             urlencode(dict(url=url.encode('utf-8'), h=h)))