You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The status of resp is 101 Switching Protocols. I can't read it, because if I will try it will stuck:
bodyBytes, _ := ioutil.ReadAll(r.Body)
So I used your library with the following code (I took it from your example):
url2 := "https://123.123.123.123:10250/exec/default/mypod/mycontainer?command=ls&command=/&input=1&output=1&tty=1"
client, err := spdy.NewClient("123.123.123.123:10250")
if err != nil {
//handle error here
}
req, err := http.NewRequest("POST", url2, nil)
if err != nil {
//handle error here
}
req.Header.Set("X-Stream-Protocol-Version", "v2.channel.k8s.io")
req.Header.Set("X-Stream-Protocol-Version", "channel.k8s.io")
req.Header.Set("Upgrade", "SPDY/3.1")
req.Header.Set("Connection","upgrade")
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
//now send the request to obtain a http response
res, err := client.Do(req)
if err != nil {
//something went wrong
}
//now handle the response
data := make([]byte, int(res.ContentLength))
_, err = res.Body.(io.Reader).Read(data)
fmt.Println(string(data))
fmt.Println(res.Header)
res.Body.Close()
After I run it, it failed with the following errors:
[SPDY] 2020/04/04 23:07:35 session.go:197: WARN: communication error: use of closed network connection
[SPDY] 2020/04/04 23:07:35 proxy.go:20: ERROR in NewClientStream: cannot create stream
404 page not found
Any idea why it failed?
With my function it returned the 101 status but with your it returns 404.
The text was updated successfully, but these errors were encountered:
The status of resp is 101 Switching Protocols. I can't read it, because if I will try it will stuck:
bodyBytes, _ := ioutil.ReadAll(r.Body)
So I used your library with the following code (I took it from your example):
url2 := "https://123.123.123.123:10250/exec/default/mypod/mycontainer?command=ls&command=/&input=1&output=1&tty=1"
client, err := spdy.NewClient("123.123.123.123:10250")
if err != nil {
//handle error here
}
req, err := http.NewRequest("POST", url2, nil)
if err != nil {
//handle error here
}
req.Header.Set("X-Stream-Protocol-Version", "v2.channel.k8s.io")
req.Header.Set("X-Stream-Protocol-Version", "channel.k8s.io")
req.Header.Set("Upgrade", "SPDY/3.1")
req.Header.Set("Connection","upgrade")
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
//now send the request to obtain a http response
res, err := client.Do(req)
if err != nil {
//something went wrong
}
//now handle the response
data := make([]byte, int(res.ContentLength))
_, err = res.Body.(io.Reader).Read(data)
fmt.Println(string(data))
fmt.Println(res.Header)
res.Body.Close()
After I run it, it failed with the following errors:
[SPDY] 2020/04/04 23:07:35 session.go:197: WARN: communication error: use of closed network connection
[SPDY] 2020/04/04 23:07:35 proxy.go:20: ERROR in NewClientStream: cannot create stream
404 page not found
Any idea why it failed?
With my function it returned the 101 status but with your it returns 404.
Hi,
I am trying to execute commands on kubelet agent in Kubernetes cluster and it uses SPDY/3.1.
When I run this function:
The status of resp is
101 Switching Protocols
. I can't read it, because if I will try it will stuck:So I used your library with the following code (I took it from your example):
After I run it, it failed with the following errors:
Any idea why it failed?
With my function it returned the 101 status but with your it returns 404.
The text was updated successfully, but these errors were encountered: