Skip to content
This repository was archived by the owner on Jun 11, 2024. It is now read-only.

Commit 2809253

Browse files
committed
http connect capture addon logs
1 parent 5b6a225 commit 2809253

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

browserup-proxy-core/src/main/resources/mitmproxy/http_connect_capture.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import time
22
import json
3+
import asyncio
34

45
from mitmproxy import ctx
56
from mitmproxy.exceptions import TcpTimeout
@@ -23,6 +24,10 @@ def __init__(self, har_connect_addon):
2324
self.har_connect_addon.har_dump_addon = a.addons[0].addons[0]
2425

2526
def on_get(self, req, resp, method_name):
27+
try:
28+
asyncio.get_event_loop()
29+
except:
30+
asyncio.set_event_loop(asyncio.new_event_loop())
2631
getattr(self, "on_" + method_name)(req, resp)
2732

2833

@@ -146,6 +151,8 @@ def populate_server_ip_address(self, flow, original_error):
146151
if flow.server_conn and flow.server_conn.ip_address:
147152
self.get_har_entry()['serverIPAddress'] = str(
148153
flow.server_conn.ip_address[0])
154+
else:
155+
ctx.log.info("Cannot populate server IP address, unknown error: {}".format(original_error))
149156

150157
def get_resource(self):
151158
return HttpConnectCaptureResource(self)

0 commit comments

Comments
 (0)