Fix client example
This commit is contained in:
parent
c6802d9d9a
commit
fde295cb25
@ -35,7 +35,8 @@ func makeRequest(url string) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
req.Certificates = append(req.Certificates, cert)
|
req.TLSConfig.InsecureSkipVerify = true
|
||||||
|
req.TLSConfig.Certificates = append(req.TLSConfig.Certificates, cert)
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
10
gemini.go
10
gemini.go
@ -99,13 +99,21 @@ func NewRequest(rawurl string) (*Request, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
host := u.Host
|
||||||
|
|
||||||
|
// If there is no port, use the default port of 1965
|
||||||
|
if u.Port() == "" {
|
||||||
|
host += ":1965"
|
||||||
|
}
|
||||||
|
|
||||||
return &Request{
|
return &Request{
|
||||||
Host: u.Host,
|
Host: host,
|
||||||
URL: u,
|
URL: u,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewProxyRequest returns a new request using the provided host.
|
// NewProxyRequest returns a new request using the provided host.
|
||||||
|
// The provided host must contain a port.
|
||||||
func NewProxyRequest(host, rawurl string) (*Request, error) {
|
func NewProxyRequest(host, rawurl string) (*Request, error) {
|
||||||
u, err := url.Parse(rawurl)
|
u, err := url.Parse(rawurl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user