Skip to content

Add `MATCH_TARGET` option to `ATTACHSTREAM`, `REDIRECTSTREAM`, and `CLOSESTREAM`

yanmaani requested to merge yanmaani/tor:matchtarget into main

This PR adds support for the MATCH_TARGET option to ATTACHSTREAM, REDIRECTSTREAM, and CLOSESTREAM, as proposed in #40376 (closed).

This PR also contains a change for the max number of arguments for CLOSESTREAM, from UINT_MAX (i.e. infinite) to 2. This is not a deviation from the spec. The spec says that there are two mandatory arguments and a potentially unlimited number of flags. The argument parser does not count flags or keyword arguments towards "arguments," i.e. mandatory arguments.

This PR also refactors handle_control_redirectstream and handle_control_closestream to remove complexity that was unneeded after the removal of smartlist_free with https://github.com/torproject/tor/pull/980.

Unit tests are included; make check runs without issue.

Merge request reports