[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser][tor-browser-158.0a1-17.0-2] fixup! TB 40933: Add tor-launcher functionality



Title: GitLab

Pier Angelo Vendrame pushed to branch tor-browser-158.0a1-17.0-2 at The Tor Project / Applications / Tor Browser

Commits:

  • 7700b2fe
    by Pier Angelo Vendrame at 2026-12-03T08:59:51+01:00
    fixup! TB 40933: Add tor-launcher functionality
    
    TB 45461: Correctly pass IPv6 addresses to little-t-tor.
    
    We were not wrapping IPv6 addresses in square brackets in tor's
    command line arguments.
    For this reason, tor failed to start when passing them to it.
    
    Original fix proposed by Perk31e.
    

1 changed file:

Changes:

  • toolkit/components/tor-launcher/TorProcess.sys.mjs
    ... ... @@ -25,6 +25,24 @@ const logger = console.createInstance({
    25 25
       prefix: "TorProcess",
    
    26 26
     });
    
    27 27
     
    
    28
    +/**
    
    29
    + * Format host and port to pass them as a command line argument to tor.
    
    30
    + *
    
    31
    + * @param {string} host - The hostname. If it looks like an IPv6 (it contains
    
    32
    + * `:`), it will be wrapped between `[` and `]`
    
    33
    + * @param {number} port - The port
    
    34
    + * @returns {string} The properly formatted host and port combination
    
    35
    + */
    
    36
    +function formatTorHostPort(host, port) {
    
    37
    +  if (!host) {
    
    38
    +    return String(port);
    
    39
    +  }
    
    40
    +  if (host.includes(":") && !host.startsWith("[")) {
    
    41
    +    return `[${host}]:${port}`;
    
    42
    +  }
    
    43
    +  return `${host}:${port}`;
    
    44
    +}
    
    45
    +
    
    28 46
     /**
    
    29 47
      * This class can be used to start a tor daemon instance and receive
    
    30 48
      * notifications when it exits.
    
    ... ... @@ -316,9 +334,10 @@ export class TorProcess {
    316 334
         if (this.#controlSettings.ipcFile) {
    
    317 335
           controlPortArg = this.#controlSettings.ipcFile;
    
    318 336
         } else if (this.#controlSettings.port) {
    
    319
    -      controlPortArg = this.#controlSettings.host
    
    320
    -        ? `${this.#controlSettings.host}:${this.#controlSettings.port}`
    
    321
    -        : this.#controlSettings.port.toString();
    
    337
    +      controlPortArg = formatTorHostPort(
    
    338
    +        this.#controlSettings.host,
    
    339
    +        this.#controlSettings.port
    
    340
    +      );
    
    322 341
         }
    
    323 342
         if (controlPortArg) {
    
    324 343
           this.#args.push("+__ControlPort", controlPortArg);
    
    ... ... @@ -347,9 +366,10 @@ export class TorProcess {
    347 366
         if (this.#socksSettings.ipcFile) {
    
    348 367
           socksPortArg = this.#socksSettings.ipcFile;
    
    349 368
         } else if (this.#socksSettings.port > 0) {
    
    350
    -      socksPortArg = this.#socksSettings.host
    
    351
    -        ? `${this.#socksSettings.host}:${this.#socksSettings.port}`
    
    352
    -        : this.#socksSettings.port.toString();
    
    369
    +      socksPortArg = formatTorHostPort(
    
    370
    +        this.#socksSettings.host,
    
    371
    +        this.#socksSettings.port
    
    372
    +      );
    
    353 373
         } else {
    
    354 374
           socksPortArg = "auto";
    
    355 375
         }
    

  • _______________________________________________
    tor-commits mailing list -- tor-commits@xxxxxxxxxxxxxxxxxxxx
    To unsubscribe send an email to tor-commits-leave@xxxxxxxxxxxxxxxxxxxx