v1.1.5
This commit is contained in:
@@ -46,7 +46,7 @@ class OTAManager:
|
||||
self._ota_url = None
|
||||
self._ota_mode = None
|
||||
self._lock = threading.Lock()
|
||||
|
||||
self._is_https = False
|
||||
self._initialized = True
|
||||
|
||||
# ==================== 状态访问(只读属性)====================
|
||||
@@ -699,11 +699,14 @@ class OTAManager:
|
||||
return False, "bad_url (no host)"
|
||||
|
||||
# 很多 ML307R 的 MHTTP 对 https 不稳定;对已知域名做降级
|
||||
|
||||
if isinstance(url, str) and url.startswith("https://static.shelingxingqiu.com/"):
|
||||
base_url = "http://static.shelingxingqiu.com"
|
||||
base_url = "https://static.shelingxingqiu.com"
|
||||
# TODO:使用https,看看是否能成功
|
||||
self._is_https = True
|
||||
else:
|
||||
base_url = f"http://{host}"
|
||||
|
||||
self._is_https = False
|
||||
logger = logger_manager.logger
|
||||
|
||||
def _log(*a):
|
||||
@@ -786,6 +789,15 @@ class OTAManager:
|
||||
_hard_reset_http()
|
||||
resp = hardware_manager.at_client.send(f'AT+MHTTPCREATE="{base_url}"', "OK", 8000)
|
||||
hid = _parse_httpid(resp)
|
||||
if self._is_https:
|
||||
resp = hardware_manager.at_client.send(f'AT+MHTTPCFG="ssl",{hid},1,1', "OK", 2000)
|
||||
if "ERROR" in resp or "CME ERROR" in resp:
|
||||
logger_manager.logger.error(f"MHTTPCFG SSL failed: {resp}")
|
||||
# 尝试https 降级到http
|
||||
downgraded_base_url = base_url.replace("https://", "http://")
|
||||
resp = hardware_manager.at_client.send(f'AT+MHTTPCREATE="{downgraded_base_url}"', "OK", 8000)
|
||||
hid = _parse_httpid(resp)
|
||||
|
||||
return hid, resp
|
||||
|
||||
def _fetch_range_into_buf(start, want_len, out_buf, full_reset=False):
|
||||
|
||||
Reference in New Issue
Block a user