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() {
|
func main() {
|
||||||
if len(os.Args) < 2 {
|
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)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
url := os.Args[1]
|
url := os.Args[1]
|
||||||
req, err := gemini.NewRequest(url)
|
req, err := gemini.NewRequest(url)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
if len(os.Args) == 3 {
|
||||||
|
req.Host = os.Args[2]
|
||||||
|
}
|
||||||
|
|
||||||
if err := doRequest(req); err != nil {
|
if err := doRequest(req); err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
|
|
@ -42,7 +42,7 @@ type responderKey struct {
|
||||||
// If no scheme is specified, a default scheme of gemini:// is assumed.
|
// If no scheme is specified, a default scheme of gemini:// is assumed.
|
||||||
//
|
//
|
||||||
// Wildcard patterns are supported (e.g. *.example.com).
|
// 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
|
// var s gemini.Server
|
||||||
// s.Certificates.Add("*.example.com", cert)
|
// s.Certificates.Add("*.example.com", cert)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user