From f725fe7ea09f0a745208df3bacca1ad3db802829 Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Fri, 14 Feb 2025 03:02:23 +0000 Subject: [PATCH] fix(vpn/tunnel): fix panic when starting tunnel with headers --- vpn/tunnel.go | 2 +- vpn/tunnel_internal_test.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/vpn/tunnel.go b/vpn/tunnel.go index 4ed21ab0269ad..002963ae02744 100644 --- a/vpn/tunnel.go +++ b/vpn/tunnel.go @@ -230,7 +230,7 @@ func (t *Tunnel) start(req *StartRequest) error { if apiToken == "" { return xerrors.New("missing api token") } - var header http.Header + header := make(http.Header) for _, h := range req.GetHeaders() { header.Add(h.GetName(), h.GetValue()) } diff --git a/vpn/tunnel_internal_test.go b/vpn/tunnel_internal_test.go index 0110ce58ab195..6cd18085ab302 100644 --- a/vpn/tunnel_internal_test.go +++ b/vpn/tunnel_internal_test.go @@ -100,6 +100,9 @@ func TestTunnel_StartStop(t *testing.T) { TunnelFileDescriptor: 2, CoderUrl: "https://coder.example.com", ApiToken: "fakeToken", + Headers: []*StartRequest_Header{ + {Name: "X-Test-Header", Value: "test"}, + }, }, }, }) 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