changed error handling (ssl spoof mode)
This commit is contained in:
parent
5c7fa7a594
commit
fbb23b5c9f
|
@ -1347,7 +1347,12 @@ class HTTPHandler(ProtocolHandler):
|
|||
|
||||
if self.c.config.mode == "sslspoof":
|
||||
# SNI is processed in server.py
|
||||
return None
|
||||
if not (flow.server_conn and flow.server_conn.ssl_established):
|
||||
print ":::::::::::::::"
|
||||
raise http.HttpError(
|
||||
400,
|
||||
"Invalid request: No host information"
|
||||
)
|
||||
|
||||
return None
|
||||
|
||||
|
|
|
@ -123,14 +123,10 @@ class ConnectionHandler:
|
|||
self.set_server_address(("-", port))
|
||||
self.establish_ssl(client=True)
|
||||
host = self.client_conn.connection.get_servername()
|
||||
if host is None:
|
||||
raise ProxyError(
|
||||
400,
|
||||
"Invalid request: No host information"
|
||||
)
|
||||
self.set_server_address((host, port))
|
||||
self.establish_server_connection()
|
||||
self.establish_ssl(server=True, sni=host)
|
||||
if host:
|
||||
self.set_server_address((host, port))
|
||||
self.establish_server_connection()
|
||||
self.establish_ssl(server=True, sni=host)
|
||||
|
||||
# Delegate handling to the protocol handler
|
||||
protocol_handler(
|
||||
|
|
|
@ -413,13 +413,8 @@ class TestSSLSpoof(tservers.SSLSpoofModeTest):
|
|||
a = ("localhost", self.server.port)
|
||||
self.config.mode.sslport = a[1]
|
||||
p = self.pathoc(sni=None)
|
||||
#assert p.ssl_established == False
|
||||
try:
|
||||
f = p.request("get:/p/304")
|
||||
#assert f.status_code == 400
|
||||
assert False
|
||||
except tcp.NetLibSSLError as v:
|
||||
assert True
|
||||
f = p.request("get:/p/304")
|
||||
assert f.status_code == 400
|
||||
|
||||
|
||||
class TestHttps2Http(tservers.ReverseProxTest):
|
||||
|
|
Loading…
Reference in New Issue