AUTH-1320: Fixed request issue and unhide the ssh command
This commit is contained in:
parent
c2ac282aca
commit
f49d9dcb67
|
@ -89,6 +89,7 @@ func createWebsocketStream(originURL string) (*websocket.Conn, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
wsConn, resp, err := websocket.ClientConnect(req, nil)
|
wsConn, resp, err := websocket.ClientConnect(req, nil)
|
||||||
if err != nil && resp != nil && resp.StatusCode > 300 {
|
if err != nil && resp != nil && resp.StatusCode > 300 {
|
||||||
location, err := resp.Location()
|
location, err := resp.Location()
|
||||||
|
@ -125,7 +126,14 @@ func buildAccessRequest(originURL string) (*http.Request, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
req.Header.Set("cf-access-token", token)
|
|
||||||
|
|
||||||
return req, nil
|
// We need to create a new request as FetchToken will modify req (boo mutable)
|
||||||
|
// as it has to follow redirect on the API and such, so here we init a new one
|
||||||
|
originRequest, err := http.NewRequest(http.MethodGet, originURL, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
originRequest.Header.Set("cf-access-token", token)
|
||||||
|
|
||||||
|
return originRequest, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,14 +89,12 @@ func Commands() []*cli.Command {
|
||||||
Usage: "",
|
Usage: "",
|
||||||
ArgsUsage: "",
|
ArgsUsage: "",
|
||||||
Description: `The ssh subcommand sends data over a proxy to the Cloudflare edge.`,
|
Description: `The ssh subcommand sends data over a proxy to the Cloudflare edge.`,
|
||||||
Hidden: true,
|
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "hostname",
|
Name: "hostname",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "url",
|
Name: "url",
|
||||||
Hidden: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -105,7 +103,6 @@ func Commands() []*cli.Command {
|
||||||
Action: sshConfig,
|
Action: sshConfig,
|
||||||
Usage: "ssh-config",
|
Usage: "ssh-config",
|
||||||
Description: `Prints an example configuration ~/.ssh/config`,
|
Description: `Prints an example configuration ~/.ssh/config`,
|
||||||
Hidden: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue