From d4390f115f76e75f848f0295a9123f4e13af5db4 Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 21 Nov 2016 12:11:55 -0500 Subject: [PATCH] allow user to force verification of ssl certificate --- resources/language/Bulgarian/strings.po | 4 ++++ resources/language/Chinese (Traditional)/strings.po | 4 ++++ resources/language/Czech/strings.po | 4 ++++ resources/language/Dutch/strings.po | 4 ++++ resources/language/English/strings.po | 4 ++++ resources/language/French/strings.po | 4 ++++ resources/language/German/strings.po | 4 ++++ resources/language/Greek/strings.po | 4 ++++ resources/language/Hebrew/strings.po | 4 ++++ resources/language/Hungarian/strings.po | 4 ++++ resources/language/Italian/strings.po | 4 ++++ resources/language/Korean/strings.po | 4 ++++ resources/language/Norwegian/strings.po | 4 ++++ resources/language/Polish/strings.po | 4 ++++ resources/language/Portuguese (Brazil)/strings.po | 4 ++++ resources/language/Portuguese/strings.po | 4 ++++ resources/language/Romanian/strings.po | 4 ++++ resources/language/Russian/strings.po | 4 ++++ resources/language/Slovak/strings.po | 4 ++++ resources/language/Spanish/strings.po | 4 ++++ resources/language/Ukrainian/strings.po | 4 ++++ resources/lib/kodion/simple_requests/api.py | 13 +++++++++++-- resources/settings.xml | 1 + 23 files changed, 96 insertions(+), 2 deletions(-) diff --git a/resources/language/Bulgarian/strings.po b/resources/language/Bulgarian/strings.po index 7cefb6c..6a4b554 100755 --- a/resources/language/Bulgarian/strings.po +++ b/resources/language/Bulgarian/strings.po @@ -577,3 +577,7 @@ msgstr "" msgctxt "#30577" msgid "Settings" msgstr "" + +msgctxt "#30578" +msgid "Force SSL Certificate verification" +msgstr "" diff --git a/resources/language/Chinese (Traditional)/strings.po b/resources/language/Chinese (Traditional)/strings.po index 04317d4..3faa9fd 100755 --- a/resources/language/Chinese (Traditional)/strings.po +++ b/resources/language/Chinese (Traditional)/strings.po @@ -577,3 +577,7 @@ msgstr "" msgctxt "#30577" msgid "Settings" msgstr "" + +msgctxt "#30578" +msgid "Force SSL Certificate verification" +msgstr "" diff --git a/resources/language/Czech/strings.po b/resources/language/Czech/strings.po index 60a116a..b4aafbe 100755 --- a/resources/language/Czech/strings.po +++ b/resources/language/Czech/strings.po @@ -577,3 +577,7 @@ msgstr "" msgctxt "#30577" msgid "Settings" msgstr "" + +msgctxt "#30578" +msgid "Force SSL Certificate verification" +msgstr "" diff --git a/resources/language/Dutch/strings.po b/resources/language/Dutch/strings.po index e7d0ecc..53de966 100644 --- a/resources/language/Dutch/strings.po +++ b/resources/language/Dutch/strings.po @@ -586,3 +586,7 @@ msgstr "" msgctxt "#30577" msgid "Settings" msgstr "" + +msgctxt "#30578" +msgid "Force SSL Certificate verification" +msgstr "" diff --git a/resources/language/English/strings.po b/resources/language/English/strings.po index 31535e4..e68a74c 100755 --- a/resources/language/English/strings.po +++ b/resources/language/English/strings.po @@ -594,3 +594,7 @@ msgstr "" msgctxt "#30577" msgid "Settings" msgstr "" + +msgctxt "#30578" +msgid "Force SSL Certificate verification" +msgstr "" diff --git a/resources/language/French/strings.po b/resources/language/French/strings.po index ae61e06..b23550c 100755 --- a/resources/language/French/strings.po +++ b/resources/language/French/strings.po @@ -586,3 +586,7 @@ msgstr "" msgctxt "#30577" msgid "Settings" msgstr "" + +msgctxt "#30578" +msgid "Force SSL Certificate verification" +msgstr "" diff --git a/resources/language/German/strings.po b/resources/language/German/strings.po index 7402d60..62f752d 100755 --- a/resources/language/German/strings.po +++ b/resources/language/German/strings.po @@ -577,3 +577,7 @@ msgstr "" msgctxt "#30577" msgid "Settings" msgstr "" + +msgctxt "#30578" +msgid "Force SSL Certificate verification" +msgstr "" diff --git a/resources/language/Greek/strings.po b/resources/language/Greek/strings.po index 01aaada..5208321 100644 --- a/resources/language/Greek/strings.po +++ b/resources/language/Greek/strings.po @@ -592,3 +592,7 @@ msgstr "Αποτυχία" msgctxt "#30577" msgid "Settings" msgstr "Ρυθμίσεις" + +msgctxt "#30578" +msgid "Force SSL Certificate verification" +msgstr "" diff --git a/resources/language/Hebrew/strings.po b/resources/language/Hebrew/strings.po index 59f9649..212de82 100755 --- a/resources/language/Hebrew/strings.po +++ b/resources/language/Hebrew/strings.po @@ -577,3 +577,7 @@ msgstr "" msgctxt "#30577" msgid "Settings" msgstr "" + +msgctxt "#30578" +msgid "Force SSL Certificate verification" +msgstr "" diff --git a/resources/language/Hungarian/strings.po b/resources/language/Hungarian/strings.po index bedd879..d8540e2 100755 --- a/resources/language/Hungarian/strings.po +++ b/resources/language/Hungarian/strings.po @@ -577,3 +577,7 @@ msgstr "" msgctxt "#30577" msgid "Settings" msgstr "" + +msgctxt "#30578" +msgid "Force SSL Certificate verification" +msgstr "" diff --git a/resources/language/Italian/strings.po b/resources/language/Italian/strings.po index 2ecd649..9216886 100755 --- a/resources/language/Italian/strings.po +++ b/resources/language/Italian/strings.po @@ -577,3 +577,7 @@ msgstr "" msgctxt "#30577" msgid "Settings" msgstr "" + +msgctxt "#30578" +msgid "Force SSL Certificate verification" +msgstr "" diff --git a/resources/language/Korean/strings.po b/resources/language/Korean/strings.po index 5212e82..105c3a7 100755 --- a/resources/language/Korean/strings.po +++ b/resources/language/Korean/strings.po @@ -577,3 +577,7 @@ msgstr "" msgctxt "#30577" msgid "Settings" msgstr "" + +msgctxt "#30578" +msgid "Force SSL Certificate verification" +msgstr "" diff --git a/resources/language/Norwegian/strings.po b/resources/language/Norwegian/strings.po index fce1c80..3e54764 100644 --- a/resources/language/Norwegian/strings.po +++ b/resources/language/Norwegian/strings.po @@ -594,3 +594,7 @@ msgstr "" msgctxt "#30577" msgid "Settings" msgstr "" + +msgctxt "#30578" +msgid "Force SSL Certificate verification" +msgstr "" diff --git a/resources/language/Polish/strings.po b/resources/language/Polish/strings.po index 0241616..0551b80 100755 --- a/resources/language/Polish/strings.po +++ b/resources/language/Polish/strings.po @@ -577,3 +577,7 @@ msgstr "" msgctxt "#30577" msgid "Settings" msgstr "" + +msgctxt "#30578" +msgid "Force SSL Certificate verification" +msgstr "" diff --git a/resources/language/Portuguese (Brazil)/strings.po b/resources/language/Portuguese (Brazil)/strings.po index 7fd8a72..8b790ab 100755 --- a/resources/language/Portuguese (Brazil)/strings.po +++ b/resources/language/Portuguese (Brazil)/strings.po @@ -575,3 +575,7 @@ msgstr "Falhou" msgctxt "#30577" msgid "Settings" msgstr "" + +msgctxt "#30578" +msgid "Force SSL Certificate verification" +msgstr "" diff --git a/resources/language/Portuguese/strings.po b/resources/language/Portuguese/strings.po index af8d4f3..bd08dc1 100755 --- a/resources/language/Portuguese/strings.po +++ b/resources/language/Portuguese/strings.po @@ -577,3 +577,7 @@ msgstr "" msgctxt "#30577" msgid "Settings" msgstr "" + +msgctxt "#30578" +msgid "Force SSL Certificate verification" +msgstr "" diff --git a/resources/language/Romanian/strings.po b/resources/language/Romanian/strings.po index 727c08e..3640374 100755 --- a/resources/language/Romanian/strings.po +++ b/resources/language/Romanian/strings.po @@ -577,3 +577,7 @@ msgstr "" msgctxt "#30577" msgid "Settings" msgstr "" + +msgctxt "#30578" +msgid "Force SSL Certificate verification" +msgstr "" diff --git a/resources/language/Russian/strings.po b/resources/language/Russian/strings.po index 15f0b12..6e86616 100755 --- a/resources/language/Russian/strings.po +++ b/resources/language/Russian/strings.po @@ -586,3 +586,7 @@ msgstr "" msgctxt "#30577" msgid "Settings" msgstr "" + +msgctxt "#30578" +msgid "Force SSL Certificate verification" +msgstr "" diff --git a/resources/language/Slovak/strings.po b/resources/language/Slovak/strings.po index 8b2172b..7bb12f8 100755 --- a/resources/language/Slovak/strings.po +++ b/resources/language/Slovak/strings.po @@ -577,3 +577,7 @@ msgstr "" msgctxt "#30577" msgid "Settings" msgstr "" + +msgctxt "#30578" +msgid "Force SSL Certificate verification" +msgstr "" diff --git a/resources/language/Spanish/strings.po b/resources/language/Spanish/strings.po index a79ef43..07ebc03 100755 --- a/resources/language/Spanish/strings.po +++ b/resources/language/Spanish/strings.po @@ -577,3 +577,7 @@ msgstr "" msgctxt "#30577" msgid "Settings" msgstr "" + +msgctxt "#30578" +msgid "Force SSL Certificate verification" +msgstr "" diff --git a/resources/language/Ukrainian/strings.po b/resources/language/Ukrainian/strings.po index 7633c74..3f3461a 100755 --- a/resources/language/Ukrainian/strings.po +++ b/resources/language/Ukrainian/strings.po @@ -577,3 +577,7 @@ msgstr "" msgctxt "#30577" msgid "Settings" msgstr "" + +msgctxt "#30578" +msgid "Force SSL Certificate verification" +msgstr "" diff --git a/resources/lib/kodion/simple_requests/api.py b/resources/lib/kodion/simple_requests/api.py index cd1b891..782d776 100755 --- a/resources/lib/kodion/simple_requests/api.py +++ b/resources/lib/kodion/simple_requests/api.py @@ -7,6 +7,10 @@ import json as real_json from ..utils import to_utf8 +from .. import Context as __Context + +__context = __Context() +__settings = __context.get_settings() class ErrorHandler(urllib2.HTTPDefaultErrorHandler): @@ -71,8 +75,13 @@ def _request(method, url, handlers = [] import sys + + _verify = __settings.get_bool('simple.requests.ssl.verify', False) + if _verify: + verify = _verify + # starting with python 2.7.9 urllib verifies every https request - if False == verify and sys.version_info >= (2, 7, 9): + if verify is False and sys.version_info >= (2, 7, 9): import ssl ssl_context = ssl.create_default_context() @@ -194,4 +203,4 @@ def delete(url, **kwargs): def head(url, **kwargs): - return _request('HEAD', url, **kwargs) \ No newline at end of file + return _request('HEAD', url, **kwargs) diff --git a/resources/settings.xml b/resources/settings.xml index 845272b..6ed0105 100755 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -40,6 +40,7 @@ +