そうではありませんか?応答が必要なく、リクエストのみを送信したいとします。私たちのコンピュータが転送したので、tcp / ipヘッダを変更できるはずですか?おそらく私が何かを見逃しているようですが、大学でそれについて学びたかっただけです。
ベストアンサー1
パラメータを使用できます-H/--header
。
IPアドレスをなりすまします。
curl --header "X-Forwarded-For: 192.168.0.2" http://example.com
例:
顧客
$ curl http://webhost.co.uk
仮想ホスト
$ tailf access.log | grep 192.168.0.54
192.168.0.54 - - [10/Nov/2014:15:56:09 +0000] "GET / HTTP/1.1" 200 14328 "-"
"curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3
libidn/1.18 libssh2/1.4.2"
IPアドレスが変更されたクライアント
$ curl --header "X-Forwarded-For: 192.168.0.99" http://webhost.co.uk
仮想ホスト
$ tailf access.log | grep 192.168.0.99
192.168.0.99 - - [10/Nov/2014:15:56:43 +0000] "GET / HTTP/1.1" 200
14328 "-" "curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0
zlib/1.2.3 libidn/1.18 libssh2/1.4.2"
男の巻き
-H/--header <header>
(HTTP) Extra header to use when getting a web page. You may
specify any number of extra headers. Note that if you should add
a custom header that has the same name as one of the internal
ones curl would use, your externally set header will be used
instead of the internal one. This allows you to make even
trickier stuff than curl would normally do. You should not
replace internally set headers without knowing perfectly well
what you’re doing. Remove an internal header by giving a
replacement without content on the right side of the colon,
as in: -H "Host:".
引用: