mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-28 01:38:08 +00:00
Fix ws console and packet capture over SSL
This commit is contained in:
parent
13630179b2
commit
61dede72f9
@ -267,11 +267,13 @@ async def stream_pcap(request: Request, link: Link = Depends(dep_link)) -> Strea
|
|||||||
async def compute_pcap_stream():
|
async def compute_pcap_stream():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
ssl_context = Controller.instance().ssl_context()
|
||||||
async with HTTPClient.request(
|
async with HTTPClient.request(
|
||||||
request.method,
|
request.method,
|
||||||
pcap_streaming_url,
|
pcap_streaming_url,
|
||||||
user=compute.user,
|
user=compute.user,
|
||||||
password=compute.password,
|
password=compute.password,
|
||||||
|
ssl_context=ssl_context,
|
||||||
timeout=None,
|
timeout=None,
|
||||||
data=body
|
data=body
|
||||||
) as response:
|
) as response:
|
||||||
|
@ -541,7 +541,7 @@ async def ws_console(
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
ws_console_compute_url = (
|
ws_console_compute_url = (
|
||||||
f"ws://{compute_host}:{compute.port}/v3/compute/projects/"
|
f"{websocket.url.scheme}://{compute_host}:{compute.port}/v3/compute/projects/"
|
||||||
f"{node.project.id}/{node.node_type}/nodes/{node.id}/console/ws"
|
f"{node.project.id}/{node.node_type}/nodes/{node.id}/console/ws"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -575,7 +575,8 @@ async def ws_console(
|
|||||||
auth = aiohttp.BasicAuth(user, password.get_secret_value(), "utf-8")
|
auth = aiohttp.BasicAuth(user, password.get_secret_value(), "utf-8")
|
||||||
else:
|
else:
|
||||||
auth = aiohttp.BasicAuth(user, "")
|
auth = aiohttp.BasicAuth(user, "")
|
||||||
async with HTTPClient.get_client().ws_connect(ws_console_compute_url, auth=auth) as ws:
|
ssl_context = Controller.instance().ssl_context()
|
||||||
|
async with HTTPClient.get_client().ws_connect(ws_console_compute_url, auth=auth, ssl_context=ssl_context) as ws:
|
||||||
asyncio.ensure_future(ws_receive(ws))
|
asyncio.ensure_future(ws_receive(ws))
|
||||||
async for msg in ws:
|
async for msg in ws:
|
||||||
if msg.type == aiohttp.WSMsgType.TEXT:
|
if msg.type == aiohttp.WSMsgType.TEXT:
|
||||||
|
Loading…
Reference in New Issue
Block a user