Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  specify next release
  add Config::disableSSLVerification()
  • Loading branch information
Baptouuuu committed Dec 14, 2023
2 parents 677d0a0 + e25ed95 commit f3282d5
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 4.2.0 - 2023-12-14

### Added

- `Innmind\OperatingSystem\Config::disableSSLVerification()`

## 4.1.0 - 2023-11-05

### Added
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"innmind/server-control": "~5.0",
"innmind/filesystem": "~7.1",
"innmind/socket": "~6.0",
"innmind/http-transport": "~7.0",
"innmind/http-transport": "~7.2",
"innmind/time-warp": "~3.0",
"innmind/signals": "~3.0",
"innmind/file-watch": "~3.1",
Expand Down
37 changes: 37 additions & 0 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ final class Config
private Maybe $maxHttpConcurrency;
/** @var Maybe<array{ElapsedPeriod, callable(): void}> */
private Maybe $httpHeartbeat;
private bool $disableSSLVerification;

/**
* @param Maybe<positive-int> $maxHttpConcurrency
Expand All @@ -44,6 +45,7 @@ private function __construct(
EnvironmentPath $path,
Maybe $maxHttpConcurrency,
Maybe $httpHeartbeat,
bool $disableSSLVerification,
) {
$this->clock = $clock;
$this->caseSensitivity = $caseSensitivity;
Expand All @@ -53,6 +55,7 @@ private function __construct(
$this->path = $path;
$this->maxHttpConcurrency = $maxHttpConcurrency;
$this->httpHeartbeat = $httpHeartbeat;
$this->disableSSLVerification = $disableSSLVerification;
}

public static function of(): self
Expand All @@ -74,6 +77,7 @@ public static function of(): self
EnvironmentPath::of(\getenv('PATH') ?: ''),
$maxHttpConcurrency,
$httpHeartbeat,
false,
);
}

Expand All @@ -91,6 +95,7 @@ public function withClock(Clock $clock): self
$this->path,
$this->maxHttpConcurrency,
$this->httpHeartbeat,
$this->disableSSLVerification,
);
}

Expand All @@ -108,6 +113,7 @@ public function caseInsensitiveFilesystem(): self
$this->path,
$this->maxHttpConcurrency,
$this->httpHeartbeat,
$this->disableSSLVerification,
);
}

Expand All @@ -129,6 +135,7 @@ public function useStreamCapabilities(Capabilities $capabilities): self
$this->path,
$this->maxHttpConcurrency,
$this->httpHeartbeat,
$this->disableSSLVerification,
);
}

Expand All @@ -146,6 +153,7 @@ public function haltProcessVia(Halt $halt): self
$this->path,
$this->maxHttpConcurrency,
$this->httpHeartbeat,
$this->disableSSLVerification,
);
}

Expand All @@ -163,6 +171,7 @@ public function withEnvironmentPath(EnvironmentPath $path): self
$path,
$this->maxHttpConcurrency,
$this->httpHeartbeat,
$this->disableSSLVerification,
);
}

Expand All @@ -182,6 +191,7 @@ public function limitHttpConcurrencyTo(int $max): self
$this->path,
Maybe::just($max),
$this->httpHeartbeat,
$this->disableSSLVerification,
);
}

Expand All @@ -201,6 +211,25 @@ public function withHttpHeartbeat(ElapsedPeriod $timeout, callable $heartbeat):
$this->path,
$this->maxHttpConcurrency,
Maybe::just([$timeout, $heartbeat]),
$this->disableSSLVerification,
);
}

/**
* @psalm-mutation-free
*/
public function disableSSLVerification(): self
{
return new self(
$this->clock,
$this->caseSensitivity,
$this->streamCapabilities,
$this->io,
$this->halt,
$this->path,
$this->maxHttpConcurrency,
$this->httpHeartbeat,
true,
);
}

Expand Down Expand Up @@ -271,4 +300,12 @@ public function httpHeartbeat(): Maybe
{
return $this->httpHeartbeat;
}

/**
* @internal
*/
public function mustDisableSSLVerification(): bool
{
return $this->disableSSLVerification;
}
}
4 changes: 4 additions & 0 deletions src/Remote/Generic.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ public function http(): HttpTransport
static fn($config) => $http->heartbeat($config[0], $config[1]),
static fn() => $http,
);
$http = match ($this->config->mustDisableSSLVerification()) {
true => $http->disableSSLVerification(),
false => $http,
};

return $this->http = $http;
}
Expand Down

0 comments on commit f3282d5

Please sign in to comment.