mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/update_example_tests' into 'master'
Update OTA example tests to make it compatible with python3 Closes IDF-1635 See merge request espressif/esp-idf!8917
This commit is contained in:
commit
d0b27b1649
@ -1,8 +1,7 @@
|
|||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
import BaseHTTPServer
|
import http.server
|
||||||
import SimpleHTTPServer
|
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
import ssl
|
import ssl
|
||||||
|
|
||||||
@ -99,7 +98,7 @@ def https_request_handler():
|
|||||||
"""
|
"""
|
||||||
Returns a request handler class that handles broken pipe exception
|
Returns a request handler class that handles broken pipe exception
|
||||||
"""
|
"""
|
||||||
class RequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
class RequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||||
def finish(self):
|
def finish(self):
|
||||||
try:
|
try:
|
||||||
if not self.wfile.closed:
|
if not self.wfile.closed:
|
||||||
@ -111,7 +110,7 @@ def https_request_handler():
|
|||||||
|
|
||||||
def handle(self):
|
def handle(self):
|
||||||
try:
|
try:
|
||||||
BaseHTTPServer.BaseHTTPRequestHandler.handle(self)
|
http.server.BaseHTTPRequestHandler.handle(self)
|
||||||
except socket.error:
|
except socket.error:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -121,8 +120,7 @@ def https_request_handler():
|
|||||||
def start_https_server(ota_image_dir, server_ip, server_port):
|
def start_https_server(ota_image_dir, server_ip, server_port):
|
||||||
server_file, key_file = get_ca_cert(ota_image_dir)
|
server_file, key_file = get_ca_cert(ota_image_dir)
|
||||||
requestHandler = https_request_handler()
|
requestHandler = https_request_handler()
|
||||||
httpd = BaseHTTPServer.HTTPServer((server_ip, server_port),
|
httpd = http.server.HTTPServer((server_ip, server_port), requestHandler)
|
||||||
requestHandler)
|
|
||||||
|
|
||||||
httpd.socket = ssl.wrap_socket(httpd.socket,
|
httpd.socket = ssl.wrap_socket(httpd.socket,
|
||||||
keyfile=key_file,
|
keyfile=key_file,
|
||||||
@ -140,7 +138,7 @@ def redirect_handler_factory(url):
|
|||||||
"""
|
"""
|
||||||
Returns a request handler class that redirects to supplied `url`
|
Returns a request handler class that redirects to supplied `url`
|
||||||
"""
|
"""
|
||||||
class RedirectHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
class RedirectHandler(http.server.SimpleHTTPRequestHandler):
|
||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
print("Sending resp, URL: " + url)
|
print("Sending resp, URL: " + url)
|
||||||
self.send_response(301)
|
self.send_response(301)
|
||||||
@ -149,7 +147,7 @@ def redirect_handler_factory(url):
|
|||||||
|
|
||||||
def handle(self):
|
def handle(self):
|
||||||
try:
|
try:
|
||||||
BaseHTTPServer.BaseHTTPRequestHandler.handle(self)
|
http.server.BaseHTTPRequestHandler.handle(self)
|
||||||
except socket.error:
|
except socket.error:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -161,8 +159,7 @@ def start_redirect_server(ota_image_dir, server_ip, server_port, redirection_por
|
|||||||
server_file, key_file = get_ca_cert(ota_image_dir)
|
server_file, key_file = get_ca_cert(ota_image_dir)
|
||||||
redirectHandler = redirect_handler_factory("https://" + server_ip + ":" + str(redirection_port) + "/advanced_https_ota.bin")
|
redirectHandler = redirect_handler_factory("https://" + server_ip + ":" + str(redirection_port) + "/advanced_https_ota.bin")
|
||||||
|
|
||||||
httpd = BaseHTTPServer.HTTPServer((server_ip, server_port),
|
httpd = http.server.HTTPServer((server_ip, server_port), redirectHandler)
|
||||||
redirectHandler)
|
|
||||||
|
|
||||||
httpd.socket = ssl.wrap_socket(httpd.socket,
|
httpd.socket = ssl.wrap_socket(httpd.socket,
|
||||||
keyfile=key_file,
|
keyfile=key_file,
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
import BaseHTTPServer
|
import http.server
|
||||||
import SimpleHTTPServer
|
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
import ssl
|
import ssl
|
||||||
|
|
||||||
@ -99,7 +98,7 @@ def https_request_handler():
|
|||||||
"""
|
"""
|
||||||
Returns a request handler class that handles broken pipe exception
|
Returns a request handler class that handles broken pipe exception
|
||||||
"""
|
"""
|
||||||
class RequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
class RequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||||
def finish(self):
|
def finish(self):
|
||||||
try:
|
try:
|
||||||
if not self.wfile.closed:
|
if not self.wfile.closed:
|
||||||
@ -111,7 +110,7 @@ def https_request_handler():
|
|||||||
|
|
||||||
def handle(self):
|
def handle(self):
|
||||||
try:
|
try:
|
||||||
BaseHTTPServer.BaseHTTPRequestHandler.handle(self)
|
http.server.BaseHTTPRequestHandler.handle(self)
|
||||||
except socket.error:
|
except socket.error:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -121,8 +120,7 @@ def https_request_handler():
|
|||||||
def start_https_server(ota_image_dir, server_ip, server_port):
|
def start_https_server(ota_image_dir, server_ip, server_port):
|
||||||
server_file, key_file = get_ca_cert(ota_image_dir)
|
server_file, key_file = get_ca_cert(ota_image_dir)
|
||||||
requestHandler = https_request_handler()
|
requestHandler = https_request_handler()
|
||||||
httpd = BaseHTTPServer.HTTPServer((server_ip, server_port),
|
httpd = http.server.HTTPServer((server_ip, server_port), requestHandler)
|
||||||
requestHandler)
|
|
||||||
|
|
||||||
httpd.socket = ssl.wrap_socket(httpd.socket,
|
httpd.socket = ssl.wrap_socket(httpd.socket,
|
||||||
keyfile=key_file,
|
keyfile=key_file,
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
import BaseHTTPServer
|
import http.server
|
||||||
import SimpleHTTPServer
|
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
import ssl
|
import ssl
|
||||||
|
|
||||||
@ -86,8 +85,7 @@ def start_https_server(ota_image_dir, server_ip, server_port):
|
|||||||
key_file_handle.write(server_key)
|
key_file_handle.write(server_key)
|
||||||
key_file_handle.close()
|
key_file_handle.close()
|
||||||
|
|
||||||
httpd = BaseHTTPServer.HTTPServer((server_ip, server_port),
|
httpd = http.server.HTTPServer((server_ip, server_port), http.server.SimpleHTTPRequestHandler)
|
||||||
SimpleHTTPServer.SimpleHTTPRequestHandler)
|
|
||||||
|
|
||||||
httpd.socket = ssl.wrap_socket(httpd.socket,
|
httpd.socket = ssl.wrap_socket(httpd.socket,
|
||||||
keyfile=key_file,
|
keyfile=key_file,
|
||||||
|
Loading…
Reference in New Issue
Block a user