Browse Source

[fix] unicode url proxiing

Adam Tauber 8 years ago
parent
commit
d5c0dcd18a
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      searx/webapp.py

+ 2
- 2
searx/webapp.py View File

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)))