Take over a system proxy that comes back to the engine

When routing returns to the running engine without the app setting it,
as Proxyman leaves it in putting back what it found, the watch now
records it as the app's: the helper is asked to point it there, which
makes the app its owner, and the password and sudo paths save a
snapshot for the port. Stopping or quitting then turns it off as it
does when the app set it. Tests cover the exact sequence on both paths,
with and without the takeover.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Gregory SchierandClaude Opus 5.5 authored and Stetta task tk_mw85knosvvdsacxu committed 2026-11-09 12:26:38 -07:00
1 parent 3f3fd15959
commit a43c3f7c2c
4 files changed
+166 -1

No files matched your search

+10
View File
@@ -1281,6 +1281,16 @@ impl ProxyCtx {
}
}
drop(intent);
// Back on the running engine without the app setting it, as Proxyman leaves it
// in putting back what it found: recorded as the app's, so it is turned off as
// the engine stops or the app quits.
if running.is_some()
&& routing.every
&& let Err(e) =
macos::adopt(port, self.system_proxy_backend(), &self.snapshot_path())
{
warn!("Failed to take over the system proxy pointing here: {e}");
}
if !routing.any
&& let Err(e) =
macos::forget(port, self.system_proxy_backend(), &self.snapshot_path())