Skip to content

Commit 49a2554

Browse files
committed
Fix fillRequestHeader with nil inbound
1 parent 495c8ac commit 49a2554

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

proxy/http/client.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,18 @@ func fillRequestHeader(ctx context.Context, header []*Header) ([]*Header, error)
173173
outbounds := session.OutboundsFromContext(ctx)
174174
ob := outbounds[len(outbounds)-1]
175175

176-
if inbound == nil || ob == nil {
177-
return nil, errors.New("missing inbound or outbound metadata from context")
176+
var src net.Destination
177+
if inbound != nil {
178+
src = inbound.Source
179+
} else {
180+
src = net.TCPDestination(net.AnyIP, 0)
178181
}
179182

180183
data := struct {
181184
Source net.Destination
182185
Target net.Destination
183186
}{
184-
Source: inbound.Source,
187+
Source: src,
185188
Target: ob.Target,
186189
}
187190

0 commit comments

Comments
 (0)