From 8d42bfb222e825d682801fa7713403088c30bd6a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Jun 2012 12:38:45 +0530 Subject: [PATCH] Fix #1013976 (Content Server with iPad problems) --- src/calibre/library/server/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/calibre/library/server/utils.py b/src/calibre/library/server/utils.py index 5d694a8ead..b697e3870a 100644 --- a/src/calibre/library/server/utils.py +++ b/src/calibre/library/server/utils.py @@ -102,7 +102,12 @@ class AuthController(object): @wraps(func) def authenticate(*args, **kwargs): cookie = cherrypy.request.cookie.get(self.cookie_name, None) - if not (allow_cookie_auth and self.is_valid(cookie)): + ua = cherrypy.request.headers.get('User-Agent', '').strip() + + if ('iPad;' in ua or 'iPhone;' in ua or ( + not (allow_cookie_auth and self.is_valid(cookie)))): + # Apparently the iPad cant handle this + # see https://bugs.launchpad.net/bugs/1013976 digest_auth(self.realm, get_ha1_dict_plain(self.users_dict), self.secret)