Add optional host argument in examples/client.go
This commit is contained in:
parent
5e4a38dccb
commit
66e4dc86d5
@ -109,16 +109,20 @@ func trustCertificate(cert *x509.Certificate) trust {
|
||||
|
||||
func main() {
|
||||
if len(os.Args) < 2 {
|
||||
fmt.Printf("usage: %s gemini://...", os.Args[0])
|
||||
fmt.Printf("usage: %s gemini://... [host]", os.Args[0])
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
url := os.Args[1]
|
||||
req, err := gemini.NewRequest(url)
|
||||
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
if len(os.Args) == 3 {
|
||||
req.Host = os.Args[2]
|
||||
}
|
||||
|
||||
if err := doRequest(req); err != nil {
|
||||
fmt.Println(err)
|
||||
|
@ -42,7 +42,7 @@ type responderKey struct {
|
||||
// If no scheme is specified, a default scheme of gemini:// is assumed.
|
||||
//
|
||||
// Wildcard patterns are supported (e.g. *.example.com).
|
||||
// To register a certificate for a wildcard domain, call Certificates.Add:
|
||||
// To register a certificate for a wildcard hostname, call Certificates.Add:
|
||||
//
|
||||
// var s gemini.Server
|
||||
// s.Certificates.Add("*.example.com", cert)
|
||||
|
Loading…
Reference in New Issue
Block a user