1
0
Fork 0
mirror of https://git.sr.ht/~adnano/go-gemini synced 2024-06-10 18:36:14 +02:00

Rename NewProxyRequest to NewRequestTo

This commit is contained in:
adnano 2020-09-27 20:37:16 -04:00
parent f6be76f8b8
commit 370bcf3bb9
2 changed files with 5 additions and 5 deletions

View File

@ -51,7 +51,7 @@ func (r *Request) Hostname() string {
return hostname(r.Host)
}
// NewRequest returns a new request. The host is inferred from the provided url.
// NewRequest returns a new request. The host is inferred from the provided URL.
func NewRequest(rawurl string) (*Request, error) {
u, err := url.Parse(rawurl)
if err != nil {
@ -71,9 +71,9 @@ func NewRequest(rawurl string) (*Request, error) {
}, nil
}
// NewProxyRequest returns a new request using the provided host.
// The provided host must contain a port.
func NewProxyRequest(host, rawurl string) (*Request, error) {
// NewRequestTo returns a new request for the provided URL to the provided host.
// The host must contain a port.
func NewRequestTo(rawurl, host string) (*Request, error) {
u, err := url.Parse(rawurl)
if err != nil {
return nil, err

View File

@ -66,7 +66,7 @@ func sendRequest(req *gmi.Request) error {
case gmi.StatusClassRedirect:
fmt.Println("Redirecting to", resp.Meta)
// Make the request to the same host
red, err := gmi.NewProxyRequest(req.Host, resp.Meta)
red, err := gmi.NewRequestTo(req.Host, resp.Meta)
if err != nil {
return err
}