Add support for HTTP proxying (#506)

* Add `--proxy` and `--no-proxy` CLI flags
* Add property `http` to `pkl:settings`
* Move `EvaluatorSettings` from `pkl:Project` to its own module and add property `http`
* Add support for proxying in server mode, and through Gradle
* Add `setProxy()` to `HttpClient`
* Add documentation
This commit is contained in:
Philip K.F. Hölzenspies
2024-06-12 19:54:22 +01:00
committed by GitHub
parent a520ae7d04
commit b03530ed1f
61 changed files with 1581 additions and 412 deletions

View File

@@ -829,3 +829,18 @@ These certificates can be overridden via either of the two options:
Both these options will *replace* the default CA certificates bundled with Pkl. +
The CLI option takes precedence over the certificates in `~/.pkl/cacerts/`. +
Certificates need to be X.509 certificates in PEM format.
[[http-proxy]]
== HTTP Proxy
When making HTTP(S) requests, Pkl can use a proxy.
By default, no proxy is configured.
A proxy can be configured as follows:
- Using `--proxy <uri>`.
The URI must (currently) have scheme `http`, and may not contain anything other than a host and port.
- Using `--no-proxy <hosts>`.
The given (comma separated list of) hosts bypass the proxy.
Hosts can be specified by domain name (in which case all subdomains also bypass the proxy), IP addresses, or IP ranges (using link:https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation[CIDR notation]).
For individual hosts (not CIDRs), ports can be specified.
When no port is specified for a given host, connections to all ports bypass the proxy.

View File

@@ -122,3 +122,21 @@ Certificates need to be X.509 certificates in PEM format.
For other methods of configuring certificates, see xref:pkl-cli:index.adoc#ca-certs[CA Certificates].
====
.--proxy
[%collapsible]
====
Default: (none) +
Example: `http://proxy.example.com:1234` +
Configures HTTP connections to connect to the provided proxy address.
The URI must have scheme `http`, and may not contain anything other than a host and port.
====
.--no-proxy
[%collapsible]
====
Default: (none) +
Example: `example.com,169.254.0.0/16` +
Comma separated list of hosts to which all connections should bypass the proxy.
Hosts can be specified by name, IP address, or IP range using https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation[CIDR notation].
====