Http Curl获取/发布包含标题的原始数据?

Http Curl获取/发布包含标题的原始数据?,http,curl,http-headers,http-post,Http,Curl,Http Headers,Http Post,在命令行curl中是否有方法将数据发布或获取(插入您喜爱的HTTP方法)到URL,并将其包含在原始发布的数据头值中,而不是发出-H选项 例如: $curl --data-binary @- http://server.com/foo/bar <<EOF X-Foo: Foo X-Bar: Bar and a lot of random characters Accept-Encoding: bzip2 My-raw-binary-data-here... EOF $curl--d

在命令行
curl
中是否有方法将数据发布或获取(插入您喜爱的HTTP方法)到URL,并将其包含在原始发布的数据头值中,而不是发出
-H
选项

例如:

$curl --data-binary @- http://server.com/foo/bar <<EOF
X-Foo: Foo
X-Bar: Bar and a lot of random characters
Accept-Encoding: bzip2

My-raw-binary-data-here...
EOF

$curl--data binary@-http://server.com/foo/bar 不,不可能。curl是一个HTTP客户机,它为您执行HTTP。如果您想更自由地编写完整请求,请使用“nc”(netcat)或类似工具。

我知道这一点。但我也知道curl只允许您使用-H而不是“raw”自定义请求头,因此我建议!)