Switch to SSL PlatformIO API

This commit is contained in:
Ivan Kravets
2016-08-25 22:57:52 +03:00
parent 012d33146c
commit 8cc54bf9be
7 changed files with 29 additions and 2 deletions

View File

@ -65,6 +65,7 @@ PlatformIO 3.0
+ Support for the 3rd party manifests (Arduino IDE "library.properties"
and ARM mbed "module.json")
* Switched to SSL PlatformIO API
* Build System: Attach custom Before/Pre and After/Post actions for targets
(`issue #542 <https://github.com/platformio/platformio/issues/542>`_)
* Print human-readable information when processing environments without

View File

@ -165,3 +165,8 @@ Allows to override setting :ref:`setting_enable_telemetry`.
.. envvar:: PLATFORMIO_SETTING_FORCE_VERBOSE
Allows to override setting :ref:`setting_force_verbose`.
.. envvar:: PLATFORMIO_SETTING_DISABLE_SSL
Allows to override setting :ref:`setting_disable_ssl`.

View File

@ -87,6 +87,16 @@ Check for the new PlatformIO interval.
Check for the platform updates interval.
.. _setting_disable_ssl:
``disable_ssl``
^^^^^^^^^^^^^^^
:Default: No
:Values: Yes/No
Disable SSL for PlatformIO API (NOT RECOMMENDED, INSECURE)
.. _setting_force_verbose:
``force_verbose``

View File

@ -14,7 +14,7 @@
import sys
VERSION = (3, 0, "0a9")
VERSION = (3, 0, "0a10")
__version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio"

View File

@ -48,6 +48,11 @@ DEFAULT_SETTINGS = {
"description": "Force verbose output when processing environments",
"value": False
},
"disable_ssl": {
"description": ("Disable SSL for PlatformIO API "
"(NOT RECOMMENDED, INSECURE)"),
"value": False
},
"enable_telemetry": {
"description":
("Telemetry service <http://docs.platformio.org/en/stable/"

View File

@ -32,7 +32,8 @@ class PlatformManager(BasePkgManager):
def __init__(self, package_dir=None, repositories=None):
if not repositories:
repositories = [
"https://dl.platformio.org/platforms/manifest.json"
"{0}://dl.platformio.org/platforms/manifest.json".format(
"http" if app.get_setting("disable_ssl") else "https")
]
BasePkgManager.__init__(self, package_dir or
join(util.get_home_dir(), "platforms"),

View File

@ -346,6 +346,8 @@ def _api_request_session():
def get_api_result(path, params=None, data=None, skipdns=False):
import requests
import app
result = None
r = None
@ -355,6 +357,9 @@ def get_api_result(path, params=None, data=None, skipdns=False):
url = "https://%s" % __apiip__
headers['host'] = __apiurl__[__apiurl__.index("://") + 3:]
if app.get_setting("disable_ssl"):
url = url.replace("https://", "http://")
try:
if data:
r = _api_request_session().post(