更新日志
This commit is contained in:
parent
be710920e9
commit
d11390e453
@ -111,7 +111,7 @@ def handle_request(request_data):
|
|||||||
if "\r\n\r\n" in modified_data:
|
if "\r\n\r\n" in modified_data:
|
||||||
body_size = len(modified_data) - modified_data.find("\r\n\r\n") - 4
|
body_size = len(modified_data) - modified_data.find("\r\n\r\n") - 4
|
||||||
|
|
||||||
log_info("System", "Request: %s %s - Body: %d bytes - ID: %s" % (method, path, body_size, request_id))
|
log_info("System", "Request: %s %s%s - Body: %d bytes - ID: %s" % (method, "http://" + TARGET_HOST + ":" + str(TARGET_PORT), path, body_size, request_id))
|
||||||
|
|
||||||
target_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
target_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
target_sock.settimeout(30)
|
target_sock.settimeout(30)
|
||||||
|
|||||||
@ -242,11 +242,13 @@ def handle_browser_request(browser_conn, browser_addr):
|
|||||||
'timestamp': time.time()
|
'timestamp': time.time()
|
||||||
}
|
}
|
||||||
|
|
||||||
if isinstance(data, bytes):
|
if b"\r\n\r\n" in data:
|
||||||
modified_data = ("X-Proxy-Request-ID: " + request_id + "\r\n").encode('utf-8') + data
|
headers_end = data.find(b"\r\n\r\n")
|
||||||
|
headers = data[:headers_end]
|
||||||
|
body = data[headers_end:]
|
||||||
|
modified_data = headers + ("\r\nX-Proxy-Request-ID: " + request_id).encode('utf-8') + body
|
||||||
else:
|
else:
|
||||||
modified_data = "X-Proxy-Request-ID: " + request_id + "\r\n" + data
|
modified_data = data + ("\r\nX-Proxy-Request-ID: " + request_id + "\r\n\r\n").encode('utf-8')
|
||||||
modified_data = modified_data.encode('utf-8')
|
|
||||||
|
|
||||||
with a_device_lock:
|
with a_device_lock:
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user