-
Notifications
You must be signed in to change notification settings - Fork 55
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
amppkg_dl_sxg: add -cert_url_path to override cert-url #329
Conversation
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.
Thanks! Minor, optional comments.
cmd/amppkg_dl_sxg/main.go
Outdated
@@ -17,6 +19,7 @@ import ( | |||
|
|||
var flagOutSXG = flag.String("out_sxg", "test.sxg", "Path to where the signed-exchange should be saved.") | |||
var flagOutCert = flag.String("out_cert", "test.cert", "Path to where the cert-chain+cbor should be saved.") | |||
var flagCertURL = flag.String("cert_url_path", "", "Override scheme, hostname and path in cert-url.") |
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.
Rename to cert_url_base. (Maybe s/path/parent path/ in the flag description?)
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.
Fixed.
cmd/amppkg_dl_sxg/main.go
Outdated
if err != nil { | ||
log.Fatalf("%+v", err) | ||
} | ||
fURL, err := url.Parse(*flagCertURL) |
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.
Maybe move this url.Parse call inside the if *flagCertURL
?
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.
Fixed.
cmd/amppkg_dl_sxg/main.go
Outdated
log.Fatalf("%+v", err) | ||
} | ||
if *flagCertURL != "" { | ||
cURL.Scheme = fURL.Scheme |
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.
How about something like:
certHash := path.Base(cURL.Path)
cURL = fURL
cURL.Path = path.Join(cURL.Path, certHash)
That way, the user can provide a user:pass@
or ?query
too. (Admittedly, rare cases.)
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.
Fixed.
During renewing of SXG cert in cluster servers, the new cert cannot be obtained in requesting cert-url from the cluster. `-cert_url_base` option enables us to overriding scheme, hostname and parent path of cert-url so that we can obtain the newer cert by specifying a server. In the server, we can get a new cert and confirm its cert renewal by using localhost such as `amppkg_dl_sxg -cert_url_base http://localhost:8080/amppkg/cert/ http://localhost:8080/priv/doc?...`
Thanks for your review. Fixes were done according to your comments. |
Thanks, merging. |
During renewing of SXG cert in cluster servers, the new cert cannot
be obtained in requesting cert-url from the cluster.
-cert_url_path
option enables us to overriding scheme, hostname and path of cert-url
so that we can obtain the newer cert by specifying a server.
In the server, we can get a new cert and confirm its cert renewal by
using localhost such as
amppkg_dl_sxg -cert_url_path http://localhost:8080/amppkg/cert/ http://localhost:8080/priv/doc?...