-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use 'cert.install' instead of passing in root certificates. #1116
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,9 +108,9 @@ download-url url/string --out-path/string --ui/Ui -> none: | |
ui.info "Downloading $url." | ||
|
||
network := net.open | ||
certificate-roots.install-all-trusted-roots | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I kinda want to this a bit earlier. That's typically how we deal with installed certificates. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done. |
||
try: | ||
client := http.Client.tls network | ||
--root-certificates=certificate-roots.ALL | ||
|
||
response := client.get --uri=url | ||
if response.status-code != http.STATUS-OK: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ import encoding.json | |
import encoding.base64 | ||
import http | ||
import net | ||
import net.x509 | ||
import tls | ||
import reader show Reader | ||
import system.storage | ||
import certificate-roots | ||
|
@@ -18,8 +18,9 @@ class HttpConnection_: | |
|
||
constructor .network_ .config_: | ||
if config_.root-certificate-ders: | ||
root-certificates_ = config_.root-certificate-ders.map: | ||
x509.Certificate.parse it | ||
config_.root-certificate-ders.do: | ||
certificate := tls.RootCertificate it | ||
certificate.install | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we do this early when setting up the config instead? There is no hash for this one (I think), so we're going to parse it every single time. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's hard to do this earlier, as the Broker is constructed relatively early, but we don't want to spend time installing roots if they won't be needed. |
||
create-fresh-client_ | ||
|
||
create-fresh-client_ -> none: | ||
|
@@ -28,9 +29,7 @@ class HttpConnection_: | |
client_ = null | ||
|
||
if config_.root-certificate-ders: | ||
client_ = http.Client.tls network_ | ||
--root-certificates=root-certificates_ | ||
--security-store=HttpSecurityStore_ | ||
client_ = http.Client.tls network_ --security-store=HttpSecurityStore_ | ||
else: | ||
client_ = http.Client network_ | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do this earlier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.