mirror of
https://github.com/apple/swift-nio-ssl
synced 2026-11-25 04:47:52 +00:00
Motivation: Currently whenever we add new config to TLSConfiguration, we add a new static factory function that needs to provide the field. This is because we currently allow configuration primarily by way of initializers. This is increasingly not scaling, leading to a proliferation of almost identical static factory functions. We can replace this proliferation by having only "default" constructions that default basically everything, and then having users use getters/setters to initialize things. This also works well when we have multiple ways of interacting with config, e.g. with the various cipher suite operations. Modifications: - Deprecate all existing factory functions. - Replace with two: forClient() and forServer(certificateChain:privateKey:). These configure only the mandatory things for each mode. - Replace all uses of the deprecated initializers with the new ones, configuring fields manually as needed. Result: More consistent configuration objects.
NIOSSLHTTP1Client
This sample application provides a https client. Invoke it using one of the following syntaxes.
swift run NIOSSLHTTP1Client # Gets a content on a server on ::1, port 4433, using SSL/TLS
swift run NIOSSLHTTP1Client "https://example.com" # Gets a content on a server on example.com, port 443, using SSL/TLS
swift run NIOSSLHTTP1Client "https://example.com:4433" # Gets a content on a server on example.com, port 4433, using SSL/TLS