mirror of
https://github.com/apple/pkl.git
synced 2026-03-26 02:51:13 +01:00
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:
committed by
GitHub
parent
a520ae7d04
commit
b03530ed1f
@@ -121,6 +121,9 @@ outputFormat: String?
|
||||
/// The project dependency settings.
|
||||
project: Project?
|
||||
|
||||
/// Configuration of outgoing HTTP requests.
|
||||
http: Http?
|
||||
|
||||
class ClientResourceReader {
|
||||
/// The URI scheme this reader is responsible for reading.
|
||||
scheme: String
|
||||
@@ -175,6 +178,54 @@ class Project {
|
||||
dependencies: Mapping<String, Project|RemoteDependency>
|
||||
}
|
||||
|
||||
/// Settings that control how Pkl talks to HTTP(S) servers.
|
||||
class Http {
|
||||
/// Configuration of the HTTP proxy to use.
|
||||
///
|
||||
/// If [null], uses the operating system's proxy configuration.
|
||||
proxy: Proxy?
|
||||
}
|
||||
|
||||
/// Settings that control how Pkl talks to HTTP proxies.
|
||||
class Proxy {
|
||||
/// The proxy to use for HTTP(S) connections.
|
||||
///
|
||||
/// At the moment, only HTTP proxies are supported.
|
||||
///
|
||||
/// Example:
|
||||
/// ```
|
||||
/// address = "http://my.proxy.example.com:5080"
|
||||
/// ```
|
||||
address: Uri(startsWith("http://"))?
|
||||
|
||||
/// Hosts to which all connections should bypass a proxy.
|
||||
///
|
||||
/// Values can be either hostnames, or IP addresses.
|
||||
/// IP addresses can optionally be provided using [CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation).
|
||||
///
|
||||
/// The only wildcard is `"*"`, which disables all proxying.
|
||||
///
|
||||
/// A hostname matches all subdomains.
|
||||
/// For example, `example.com` matches `foo.example.com`, but not `fooexample.com`.
|
||||
/// A hostname that is prefixed with a dot matches the hostname itself,
|
||||
/// so `.example.com` matches `example.com`.
|
||||
///
|
||||
/// Optionally, a port can be specified.
|
||||
/// If a port is omitted, all ports are matched.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// ```
|
||||
/// noProxy {
|
||||
/// "127.0.0.1"
|
||||
/// "169.254.0.0/16"
|
||||
/// "example.com"
|
||||
/// "localhost:5050"
|
||||
/// }
|
||||
/// ```
|
||||
noProxy: Listing<String>(isDistinct)
|
||||
}
|
||||
|
||||
class RemoteDependency {
|
||||
type: "remote"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user