mirror of https://github.com/v2ray/v2ray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
448 B
21 lines
448 B
7 years ago
|
package http_test
|
||
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
"testing"
|
||
|
|
||
|
. "v2ray.com/core/common/protocol/http"
|
||
|
. "v2ray.com/ext/assert"
|
||
|
)
|
||
|
|
||
|
func TestParseXForwardedFor(t *testing.T) {
|
||
|
assert := With(t)
|
||
|
|
||
|
header := http.Header{}
|
||
|
header.Add("X-Forwarded-For", "129.78.138.66, 129.78.64.103")
|
||
|
addrs := ParseXForwardedFor(header)
|
||
|
assert(len(addrs), Equals, 2)
|
||
|
assert(addrs[0].String(), Equals, "129.78.138.66")
|
||
|
assert(addrs[1].String(), Equals, "129.78.64.103")
|
||
|
}
|