-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes multiple problems with http processing/tagging on Windows. #15022
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2016-present Datadog, Inc. | ||
|
||
//go:build windows && npm | ||
// +build windows,npm | ||
|
||
package http | ||
|
||
import ( | ||
"encoding/binary" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestIsLocalhost(t *testing.T) { | ||
|
||
tests := []struct { | ||
key Key | ||
expected bool | ||
}{ | ||
// the isLocalhost function checks only the srcip, but set them both | ||
{ | ||
key: Key{ | ||
KeyTuple: KeyTuple{ | ||
SrcIPHigh: 0, | ||
SrcIPLow: uint64(binary.LittleEndian.Uint32([]uint8{127, 0, 0, 1})), | ||
DstIPHigh: 0, | ||
DstIPLow: uint64(binary.LittleEndian.Uint32([]uint8{127, 0, 0, 1})), | ||
}, | ||
}, | ||
expected: true, | ||
}, | ||
{ | ||
key: Key{ | ||
KeyTuple: KeyTuple{ | ||
SrcIPHigh: 0, | ||
SrcIPLow: uint64(binary.LittleEndian.Uint32([]uint8{192, 168, 1, 1})), | ||
DstIPHigh: 0, | ||
DstIPLow: uint64(binary.LittleEndian.Uint32([]uint8{192, 168, 1, 1})), | ||
}, | ||
}, | ||
expected: false, | ||
}, | ||
{ | ||
key: Key{ | ||
KeyTuple: KeyTuple{ | ||
SrcIPHigh: 0, | ||
SrcIPLow: binary.LittleEndian.Uint64([]uint8{0, 0, 0, 0, 0, 0, 0, 1}), | ||
DstIPHigh: 0, | ||
DstIPLow: binary.LittleEndian.Uint64([]uint8{0, 0, 0, 0, 0, 0, 0, 1}), | ||
}, | ||
}, | ||
expected: true, | ||
}, | ||
{ | ||
key: Key{ | ||
KeyTuple: KeyTuple{ | ||
SrcIPHigh: binary.LittleEndian.Uint64([]uint8{0xf, 0xe, 0x8, 0, 0, 0, 0, 0}), | ||
SrcIPLow: binary.LittleEndian.Uint64([]uint8{0x1, 0x9, 0x3, 0xe, 0x4, 0xc, 0xd, 0x6, 0xf, 0xf, 0xa, 0x4}), | ||
DstIPHigh: binary.LittleEndian.Uint64([]uint8{0xf, 0xe, 0x8, 0, 0, 0, 0, 0}), | ||
DstIPLow: binary.LittleEndian.Uint64([]uint8{0x1, 0x9, 0x3, 0xe, 0x4, 0xc, 0xd, 0x6, 0xf, 0xf, 0xa, 0x4}), | ||
}, | ||
}, | ||
expected: false, | ||
}, | ||
} | ||
for idx, tt := range tests { | ||
is := isLocalhost(tt.key) | ||
assert.Equal(t, tt.expected, is, "Unexpected result %v for test %v", is, idx) | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
releasenotes/notes/fixwinhttploopback-cec77f41a8feff7f.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Each section from every release note are combined when the | ||
# CHANGELOG.rst is rendered. So the text needs to be worded so that | ||
# it does not depend on any information only available in another | ||
# section. This may mean repeating some details, but each section | ||
# must be readable independently of the other. | ||
# | ||
# Each section note must be formatted as reStructuredText. | ||
--- | ||
fixes: | ||
- | | ||
On Windows, fixes bug in which HTTP connections were not properly accounted | ||
for when the client and server were the same host (loopback). |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch