Repository: kivy/kivy

Issue:
Regular http requests via UrlRequest fail on Android
**Software Versions**
* Python: v3.8.1
* OS: Android 9 API29
* Kivy: v2.0.0rc2
* Kivy installation method: python-for-android develop

**Describe the bug**
Since #6703, regular http requests via urlrequest no longer work on android. The on_error function of urlrequest is called, while on desktop it is successful. Going back to kivy v2.0.0rc1 fixes it, but this version has broken https.

**Expected behavior**
Successful regular http requests.

**To Reproduce**
```python
from kivy.app import runTouchApp
from kivy.uix.widget import Widget
from kivy.network.urlrequest import UrlRequest


class Test(Widget):
    def __init__(self, **kwargs):
        super(Test, self).__init__(**kwargs)
        UrlRequest(
            url='http://lipsum.com/',
            on_error=lambda *args: print('error:', args),
            on_failure=lambda *args: print('fail:', args),
            on_redirect=lambda *args: print('redir:', args),
            on_success=lambda *args: print('success:', args)
        )
        UrlRequest(
            url='https://lipsum.com/',
            on_error=lambda *args: print('error:', args),
            on_failure=lambda *args: print('fail:', args),
            on_redirect=lambda *args: print('redir:', args),
            on_success=lambda *args: print('success:', args)
        )


runTouchApp(Test())

```

**Code and Logs and screenshots**
```python
TypeError("__init__() got an unexpected keyword argument 'context'")
```


Discussion:

Patch:
diff --git a/kivy/network/urlrequest.py b/kivy/network/urlrequest.py
index 4b55b73f3..798bb6e09 100644
--- a/kivy/network/urlrequest.py
+++ b/kivy/network/urlrequest.py
@@ -334,7 +334,8 @@ class UrlRequest(Thread):
         if timeout is not None:
             args['timeout'] = timeout
 
-        if ca_file is not None and hasattr(ssl, 'create_default_context'):
+        if (ca_file is not None and hasattr(ssl, 'create_default_context') and
+                parse.scheme == 'https'):
             ctx = ssl.create_default_context(cafile=ca_file)
             ctx.verify_mode = ssl.CERT_REQUIRED
             args['context'] = ctx


Test patch:
diff --git a/kivy/tests/test_urlrequest.py b/kivy/tests/test_urlrequest.py
index 2d0ae5e55..a9e3ba29d 100644
--- a/kivy/tests/test_urlrequest.py
+++ b/kivy/tests/test_urlrequest.py
@@ -130,3 +130,29 @@ def test_auth_auto(kivy_clock):
     ensure_called_from_thread(queue)
     check_queue_values(queue)
     assert queue[-1][2] == ({'authenticated': True, 'user': 'user'}, )
+
+
+@pytest.mark.skipif(os.environ.get('nonetwork'), reason="no network")
+@pytest.mark.parametrize("scheme", ("http", "https"))
+def test_ca_file(kivy_clock, scheme):
+    """Passing a `ca_file` should not crash on http scheme, refs #6946"""
+    from kivy.network.urlrequest import UrlRequest
+    import certifi
+    obj = UrlRequestQueue([])
+    queue = obj.queue
+    req = UrlRequest(
+        f"{scheme}://httpbin.org/get",
+        on_success=obj._on_success,
+        on_progress=obj._on_progress,
+        on_error=obj._on_error,
+        on_redirect=obj._on_redirect,
+        ca_file=certifi.where(),
+        debug=True
+    )
+    wait_request_is_finished(kivy_clock, req)
+
+    if req.error and req.error.errno == 11001:
+        pytest.skip('Cannot connect to get address')
+
+    ensure_called_from_thread(queue)
+    check_queue_values(queue)