Skip to content

Commit edd982e

Browse files
fix(vpn/tunnel): fix panic when starting tunnel with headers (#16565)
`http.Header` is a map so it needs to be initialized ..
1 parent b23e3f9 commit edd982e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

vpn/tunnel.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ func (t *Tunnel) start(req *StartRequest) error {
230230
if apiToken == "" {
231231
return xerrors.New("missing api token")
232232
}
233-
var header http.Header
233+
header := make(http.Header)
234234
for _, h := range req.GetHeaders() {
235235
header.Add(h.GetName(), h.GetValue())
236236
}

vpn/tunnel_internal_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ func TestTunnel_StartStop(t *testing.T) {
100100
TunnelFileDescriptor: 2,
101101
CoderUrl: "https://coder.example.com",
102102
ApiToken: "fakeToken",
103+
Headers: []*StartRequest_Header{
104+
{Name: "X-Test-Header", Value: "test"},
105+
},
103106
},
104107
},
105108
})

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy