mirror of
https://github.com/BaaRai/ARTEX.git
synced 2026-11-28 02:40:53 +08:00
fix(extension): bound in-flight capture requests
Requests that never finish stayed in the debugger map with their full post body. The map now drops the oldest entry past 500, and a stored body is cut at the ingest limit.
This commit is contained in:
@@ -6,6 +6,7 @@ All notable changes to this project are documented in this file. The format is b
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Browser capture keeps a bounded request map**: unfinished debugger requests are capped at 500, and a stored request body is cut at the same 256 KiB limit as ingest.
|
||||
- **Docker Compose database passwords with URL-special characters**: `docker-compose.yml` no longer pastes `POSTGRES_PASSWORD` into `ARTEX_PG_DSN`. The server builds the URL from `ARTEX_PG_HOST`, `ARTEX_PG_PORT`, `ARTEX_PG_USER`, `ARTEX_PG_PASSWORD`, `ARTEX_PG_DBNAME` and `ARTEX_PG_SSLMODE`, percent-encoding the user and password, so `/`, `?`, `%`, `@`, `:` and spaces connect. An explicit `ARTEX_PG_DSN` still wins and is not rewritten. `ARTEX_PG_PASSWORD` is removed from the environment with the other startup secrets (#450).
|
||||
|
||||
## [0.7.0] - 2026-11-21
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
const FLUSH_AT = 10; // entries per batch
|
||||
const MAX_BODY = 256 * 1024; // matches the server-side ingest cap
|
||||
const MAX_TRACKED = 500; // unfinished requests kept in memory
|
||||
const SKIP_MIME = ["image/", "font/", "audio/", "video/", "application/octet-stream"];
|
||||
|
||||
let session = {
|
||||
@@ -167,12 +168,18 @@ async function flush() {
|
||||
chrome.debugger.onEvent.addListener((source, method, params) => {
|
||||
if (!session.capturing || !source.tabId || source.tabId !== session.tabId) return;
|
||||
if (method === "Network.requestWillBeSent") {
|
||||
let postData = params.request.postData || "";
|
||||
if (postData.length > MAX_BODY) postData = postData.slice(0, MAX_BODY);
|
||||
if (!session.requests.has(params.requestId) && session.requests.size >= MAX_TRACKED) {
|
||||
const oldest = session.requests.keys().next().value;
|
||||
session.requests.delete(oldest);
|
||||
}
|
||||
session.requests.set(params.requestId, {
|
||||
requestId: params.requestId,
|
||||
method: params.request.method,
|
||||
url: params.request.url,
|
||||
headers: params.request.headers,
|
||||
postData: params.request.postData || "",
|
||||
postData,
|
||||
});
|
||||
} else if (method === "Network.responseReceived") {
|
||||
const info = session.requests.get(params.requestId);
|
||||
|
||||
Reference in New Issue
Block a user