TUN-4889: Add back appendtagheaders function

TUN-4701 accidentally removed adding tagheaders. This commit adds it
back.
This commit is contained in:
Sudarsan Reddy 2021-08-23 16:04:09 +01:00
parent 3ef3e7a99a
commit b6c85401a5
4 changed files with 5 additions and 3 deletions

View File

@ -76,7 +76,6 @@ func (p Protocol) TLSSettings() *TLSSettings {
ServerName: edgeH2TLSServerName, ServerName: edgeH2TLSServerName,
} }
case QUIC: case QUIC:
fmt.Println("returning this?")
return &TLSSettings{ return &TLSSettings{
ServerName: edgeQUICServerName, ServerName: edgeQUICServerName,
NextProtos: []string{"argotunnel"}, NextProtos: []string{"argotunnel"},

View File

@ -106,7 +106,6 @@ func (q *QUICConnection) handleStream(stream quic.Stream) error {
w := newHTTPResponseAdapter(stream) w := newHTTPResponseAdapter(stream)
return q.httpProxy.ProxyHTTP(w, req, connectRequest.Type == quicpogs.ConnectionTypeWebsocket) return q.httpProxy.ProxyHTTP(w, req, connectRequest.Type == quicpogs.ConnectionTypeWebsocket)
case quicpogs.ConnectionTypeTCP: case quicpogs.ConnectionTypeTCP:
// TODO: This is a placeholder for testing completion. TUN-4865 will add proper TCP support.
rwa := &streamReadWriteAcker{ rwa := &streamReadWriteAcker{
ReadWriter: stream, ReadWriter: stream,
} }

View File

@ -63,6 +63,7 @@ func (p *Proxy) ProxyHTTP(
cfRay := connection.FindCfRayHeader(req) cfRay := connection.FindCfRayHeader(req)
lbProbe := connection.IsLBProbeRequest(req) lbProbe := connection.IsLBProbeRequest(req)
p.appendTagHeaders(req)
rule, ruleNum := p.ingressRules.FindMatchingRule(req.Host, req.URL.Path) rule, ruleNum := p.ingressRules.FindMatchingRule(req.Host, req.URL.Path)
logFields := logFields{ logFields := logFields{

View File

@ -30,7 +30,7 @@ import (
) )
var ( var (
testTags = []tunnelpogs.Tag(nil) testTags = []tunnelpogs.Tag{tunnelpogs.Tag{Name: "Name", Value: "value"}}
unusedWarpRoutingService = (*ingress.WarpRoutingService)(nil) unusedWarpRoutingService = (*ingress.WarpRoutingService)(nil)
) )
@ -150,6 +150,9 @@ func testProxyHTTP(proxy connection.OriginProxy) func(t *testing.T) {
err = proxy.ProxyHTTP(responseWriter, req, false) err = proxy.ProxyHTTP(responseWriter, req, false)
require.NoError(t, err) require.NoError(t, err)
for _, tag := range testTags {
assert.Equal(t, tag.Value, req.Header.Get(TagHeaderNamePrefix+tag.Name))
}
assert.Equal(t, http.StatusOK, responseWriter.Code) assert.Equal(t, http.StatusOK, responseWriter.Code)
} }