Commit Graph

306 Commits

Author SHA1 Message Date
wanghongenpin
bb88aac6b8 feat(selection): implement multi-select functionality with action bar (#730) (#566) 2026-05-19 03:29:26 +08:00
wanghongenpin
6ae7b0962c feat(http_proxy): enhance error handling and add request rewrite on connect failure (#740) 2026-05-15 22:32:40 +08:00
testercengdong
71e49421ae fix(macos,process_info): filter LISTEN sockets + .app suffix + alloc safety
Three issues raised by ultrareview on top of the previous review pass:

1. (regression) findPidByLocalTcpPort accepted any TCP socket whose
   insi_lport matched, including LISTEN sockets. The original
   `lsof | grep "${port}->"` excluded LISTEN entries implicitly via the
   "->" filter (LISTEN renders as `*:port (LISTEN)`, no `->`). When a
   long-running daemon LISTENs on a port that coincides with a client's
   ephemeral source port, proc_listpids hits the lower-PID daemon first
   and misattributes the request; with the new 30s pid cache the wrong
   PID stuck for 30s of follow-up requests. Now skip sockets with
   insi_fport == 0 (the LISTEN signature) to mirror the old grep filter
   exactly.

2. (pre-existing) getProcess in the macOS path unconditionally appended
   ".app" to the executable path, producing non-existent paths like
   "/usr/bin/curl.app" for non-bundle binaries. This poisoned the icon
   cache with empty bytes for 5 minutes. Now only append when the path
   actually contains ".app/"; standalone binaries use the executable
   path verbatim.

3. (nit) pidBuf/sockBuf were allocated before the outer try, leaking on
   the (extremely rare) case that the second calloc throws. Moved both
   allocations inside the try with null-aware free in finally, matching
   the pattern the inner fdBuf loop already uses.

Verified:
- LISTEN-only port -> FFI returns null (matches lsof+grep behavior)
- ESTABLISHED outbound -> FFI returns the correct client PID
- 500 concurrent curl through proxy -> single ProxyPin process, no
  fork leaks (original #763 fix preserved)
2026-05-12 11:28:33 +08:00
testercengdong
d69b95dbbc fix(macos,process_info): tighten error handling and add endian assert
- Guard against `getProcess` returning null in the macOS FFI path
  (`proc_pidpath` can fail with EPERM or for an already-exited PID).
  Stop unwrapping with `!` and only populate the ProcessInfoCache on
  success; the previous code threw NullThrownError there, which the
  outer try/catch silently swallowed and prevented caching of valid
  later results.
- Add a 5-second negative cache for ports whose owner can't be
  resolved (typical for short-lived clients that exited before we
  scanned). Without it every such request triggered a full PID list
  rescan, defeating the point of the pid cache for the failure path.
- Add a debug-only assert that the host is little-endian. The libproc
  parsing reads `(int)htons(port)` by treating the low two bytes as a
  big-endian uint16, which requires a little-endian host. All shipping
  macOS hardware satisfies this; the assert fails loudly if the
  assumption is ever broken (stripped from release builds).

Re-verified on macOS 26.4: 500 concurrent curl through the proxy,
single ProxyPin process throughout, 9099 freed immediately on exit.
2026-05-12 10:16:42 +08:00
testercengdong
ad89ec6aec fix(macos,process_info): address Copilot review feedback
- Add 30s (host:port) -> pid cache in ProcessInfoUtils so the synchronous
  libproc scan stays off the request hot path for keep-alive flows
  (typical HTTP client reuses the same source port across requests in
  a connection).
- Lift sockView ByteData out of the inner fd loop so the buffer wrapper
  is reused across all fds in a scan (saves per-fd allocations).
- Bail out of the scan after 16 consecutive proc_pidfdinfo size
  mismatches, in case a future macOS bumps the socket_fdinfo layout --
  avoids wasted syscalls instead of scanning every fd just to return
  null at the end.

Re-verified end-to-end on macOS 26.4: 500 concurrent curl, 0 fork
leaks, 9099 freed immediately on app exit, no errors in logs.
2026-05-12 09:38:02 +08:00
testercengdong
202050b35f fix(macos): use libproc FFI for process info to eliminate fork leak
Replace Process.run('lsof') and Process.run('ps') in the request hot
path with direct libproc syscalls (proc_listpids, proc_pidinfo,
proc_pidfdinfo, proc_pidpath) via dart:ffi.

Each Process.run on macOS goes through fork()+execvp(). In a
multi-threaded Dart VM the forked child can deadlock before exec on
mutexes that were held by other threads at fork time (POSIX fork()
only clones the calling thread, leaving cloned mutex state with no
owners in the child). Under proxy load (~500 concurrent requests),
roughly 2% of the fork()s deadlock; the orphaned children inherit the
listening proxy fd and pin it for the lifetime of the system, so the
port stays bound even after the parent app exits.

libproc syscalls do not spawn child processes, so they avoid the fork
problem entirely. They are also about an order of magnitude faster
than spawning lsof per request.

Windows and Linux paths are unchanged (independent follow-up).

Verified end-to-end on macOS 26.4 / Darwin 25.4:
- 500 concurrent curl through the proxy: 0 fork leaks (was ~2% before)
- Process icons still resolve correctly for .app bundles (Chrome,
  Safari, Lark, etc.)
- 9099 frees immediately on app exit (no orphan listeners)

Fixes #763
2026-05-11 15:23:59 +08:00
Pandaver
b887aa4854 fix: handle error phase and sync response param in split report mode
分离模式下 onError 时跳过 response 阶段上报,
同时显式同步 response 参数到 request.response 避免参数被忽略。
2026-04-22 21:24:06 +08:00
Pandaver
9d420d086a Merge branch 'wanghongenpin:main' into main 2026-04-22 20:46:08 +08:00
Pandaver
ddad789d6f feat: add split report mode for report server
支持分离上报模式,开启后 request 和 response 分两次独立上报,
通过 _id 关联。解决 response 超时或无响应时请求无法上报的问题。
2026-04-21 12:53:44 +08:00
Pandaver
554124d494 fix: URL encode report server name to support non-ASCII characters (#744) 2026-04-13 11:53:06 +08:00
wanghongenpin
bcd8af3e2d feat: add XML and HTML formatting support (#721) 2026-04-04 00:59:46 +08:00
wanghongenpin
654d27667a feat: implement batch processing for remote history sharing 2026-03-30 03:12:41 +08:00
wanghongenpin
1aff89ed8c feat: implement quick share functionality for remote devices 2026-03-29 02:14:19 +08:00
wanghongenpin
69cc1aff8d refactor: enhance auto-read request management 2026-03-25 01:29:50 +08:00
wanghongenpin
8ab517bb38 Favorites support WebSocket message persistence (#709) 2026-03-20 19:21:11 +08:00
wanghongenpin
25fec1f5e0 fix h2 IPv6 parse 2026-03-11 21:04:49 +08:00
wanghongenpin
42842236ea Update request breakpoint matching to use regular expressions for improved URL matching 2026-03-10 22:06:28 +08:00
wanghongenpin
531732696d Enhance request and response handling to support null values and improve breakpoint execution logic 2026-02-28 21:29:48 +08:00
wanghongenpin
3c4b97380d Refactor request breakpoint handling to use ExpiringCache for paused requests and responses 2026-02-28 21:22:25 +08:00
wanghongenpin
6bf5063bed Add autocomplete suggestions for HTTP headers in request editor 2026-02-27 01:00:03 +08:00
wanghongenpin
ff06ac924a support additional SOCKS5 address types: domain and IPv6 (#699) 2026-02-19 22:21:33 +08:00
wanghongenpin
d4465bcd29 implement request and response breakpoint functionality with UI integration (#669)(#660)(#386) 2026-02-18 22:59:01 +08:00
wanghongenpin
f418a20568 add request breakpoint functionality (#669)(#660)(#386) 2026-02-16 21:57:09 +08:00
wanghongenpin
c4d3421373 ios proxy pass domains (#527) 2026-02-15 01:25:05 +08:00
wanghongenpin
a3e744ee2e android proxy pass domains (#527) 2026-02-08 12:45:24 +08:00
wanghongenpin
b838bf73b9 fix mac set system proxy (#672) 2026-02-06 16:15:03 +08:00
wanghongenpin
e9574e7abc Add zlib decoding support and fix encoding order in HTTP response handling 2026-01-30 12:14:19 +08:00
wanghongenpin
c181767878 Enhance script management with remote URL support and improved logging (#490) 2026-01-19 09:19:03 +08:00
wanghongenpin
0012116fa0 Add localization support for remote script management 2026-01-17 07:07:38 +08:00
wanghongenpin
570912ab24 Add support for remote scripts 2026-01-16 09:30:21 +08:00
wanghongenpin
b1220e18ef macos set system proxy with osascript privileges 2026-01-14 23:49:07 +08:00
wanghongenpin
4beef9a360 Add option to include system apps in installed apps retrieval (#549) 2026-01-12 08:58:43 +08:00
wanghongenpin
cc503dc42a Refactor request crypto UI and enhance AES key handling (#500)(#335)(#472) 2026-01-06 00:18:15 +08:00
wanghongenpin
dee8f45d91 Add request crypto functionality (#500)(#335)(#472) 2026-01-02 20:35:06 +08:00
wanghongenpin
9c7a9da67b Add export/import functionality for favorites (#655) 2025-12-27 01:34:27 +08:00
wanghongenpin
2281401c48 desktop request rewrite rule method match (#626) 2025-12-07 01:08:49 +08:00
wanghongenpin
6f28d413c6 http2 text/event-stream forward (#555) 2025-11-20 23:55:31 +08:00
wanghongenpin
4289eeaf06 text/event-stream handle (#555) 2025-11-13 20:58:01 +08:00
wanghongenpin
f6f2f99535 Add report name to header 2025-10-28 14:32:11 +08:00
wanghongenpin
258c21721e Mobile support report server 2025-10-25 02:18:57 +08:00
wanghongenpin
aa49bb6226 Desktop support report server 2025-10-25 01:49:22 +08:00
wanghongenpin
f37330a517 The script supports multiple URL matching 2025-09-23 22:43:28 +08:00
wanghongenpin
3cc7d8d303 IOS certificate installation detection and guidance 2025-09-21 20:09:40 +08:00
wanghongenpin
4e44921775 initCAConfig 2025-09-19 19:55:22 +08:00
wanghongenpin
f861beaa88 Windows Automatic Install Certificate 2025-09-18 23:55:23 +08:00
wanghongenpin
07ffeb8e0f fix js fetch headers (##589) 2025-09-12 00:36:22 +08:00
wanghongenpin
bd692410ec websocket preview 2025-09-09 22:13:37 +08:00
wanghongenpin
853348f1d5 hex viewer 2025-09-09 19:50:50 +08:00
wanghongenpin
2c3c01480c parse MediaType 2025-09-06 18:33:03 +08:00
wanghongenpin
53fedc0713 1.2.1-pre 2025-09-05 07:43:00 +08:00