Rename NewProxyRequest to NewRequestTo
This commit is contained in:
parent
f6be76f8b8
commit
370bcf3bb9
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user