mirror of
https://github.com/curl/curl.git
synced 2026-08-25 08:43:31 +03:00
haproxy: add --haproxy-clientip flag to spoof client IPs
CURLOPT_HAPROXY_CLIENT_IP in the library Closes #10779
This commit is contained in:
parent
9ad23c38e5
commit
0a75964d0d
21 changed files with 267 additions and 4 deletions
|
|
@ -258,4 +258,5 @@ test3016 test3017 test3018 test3019 test3020 test3021 test3022 test3023 \
|
|||
test3024 test3025 test3026 test3027 test3028 test3029 test3030 \
|
||||
\
|
||||
test3100 test3101 \
|
||||
test3200
|
||||
test3200 \
|
||||
test3201 test3202
|
||||
|
|
|
|||
63
tests/data/test3201
Normal file
63
tests/data/test3201
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
HTTP GET
|
||||
proxy
|
||||
haproxy
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
#
|
||||
# Server-side
|
||||
<reply name="%TESTNUMBER">
|
||||
<data nocheck="yes">
|
||||
HTTP/1.1 200 OK
|
||||
Date: Tue, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
|
||||
ETag: "21025-dc7-39462498"
|
||||
Accept-Ranges: bytes
|
||||
Content-Length: 6
|
||||
Connection: close
|
||||
Content-Type: text/html
|
||||
Funny-head: barkbark
|
||||
|
||||
-foo-
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<name>
|
||||
HTTP GET when PROXY Protocol enabled and spoofed client IP
|
||||
</name>
|
||||
<command>
|
||||
http://%HOSTIP:%HTTPPORT/%TESTNUMBER --haproxy-clientip "192.168.1.1" -H "Testno: %TESTNUMBER"
|
||||
</command>
|
||||
<features>
|
||||
proxy
|
||||
</features>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<strippart>
|
||||
s/^PROXY TCP4 %CLIENTIP 192.168.1.1 (\d*) %HTTPPORT/proxy-line/
|
||||
</strippart>
|
||||
<protocol>
|
||||
proxy-line
|
||||
GET /%TESTNUMBER HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Testno: %TESTNUMBER
|
||||
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
||||
67
tests/data/test3202
Normal file
67
tests/data/test3202
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
HTTP GET
|
||||
proxy
|
||||
haproxy
|
||||
IPv6
|
||||
</keywords>
|
||||
</info>
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data nocheck="yes">
|
||||
HTTP/1.1 200 OK
|
||||
Date: Tue, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
|
||||
ETag: "21025-dc7-39462498"
|
||||
Accept-Ranges: bytes
|
||||
Content-Length: 6
|
||||
Connection: close
|
||||
Content-Type: text/html
|
||||
Funny-head: yesyes
|
||||
|
||||
These data aren't actually sent to the client
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<features>
|
||||
ipv6
|
||||
</features>
|
||||
<server>
|
||||
http-ipv6
|
||||
</server>
|
||||
<name>
|
||||
HTTP-IPv6 GET with PROXY protocol with spoofed client IP
|
||||
</name>
|
||||
<command>
|
||||
-g "http://%HOST6IP:%HTTP6PORT/%TESTNUMBER" --haproxy-clientip "2001:db8::"
|
||||
</command>
|
||||
<features>
|
||||
proxy
|
||||
</features>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
# Strip off the (random) local port number. This test used to use a fixed
|
||||
# local port number that frequently causes the test to fail
|
||||
<strippart>
|
||||
s/PROXY TCP6 ::1 2001:db8:: (\d+) (\d+)/PROXY TCP6 ::1 2001:db8:: $2/
|
||||
</strippart>
|
||||
<protocol>
|
||||
PROXY TCP6 ::1 2001:db8:: %HTTP6PORT
|
||||
GET /%TESTNUMBER HTTP/1.1
|
||||
Host: %HOST6IP:%HTTP6PORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
||||
Loading…
Add table
Add a link
Reference in a new issue