为什么 Transfer-Encoding 请求头不能正确解释?
Why Transfer-Encoding request header does not interpret correctly?
这是 pg3.php 的 PHP 代码:
<html>
<body>
<form method="post" action="pg3.php">
<h2><font color="red">::Welcome to Server1: 172.16.24.150::</font></h2>
<input type="text" name="user">
<input type="submit" value="Submit">
</body>
</html>
<?php
if(!empty($_POST["user"])){
echo $_POST["user"];
}
?>
我发送了以下请求:
curl --data "8\r\nuser=mehran\r\n0\r\n" --header "Transfer-Encoding: chunked" "http://172.16.17.10/pg3.php"
我收到以下回复:
<html>
<body>
<form method="post" action="pg3.php">
<h2><font color="red">::Welcome to Server1: 172.16.24.150::</font></h2>
<input type="text" name="user">
<input type="submit" value="Submit">
</body>
</html>
如上所示,user=meh 不在响应中,但如果 Transfer-Encoding 正常工作,它必须存在。
有什么问题??
TNX.
参见this example in the documentation:
You send a chunked POST with curl like this:
curl -H "Transfer-Encoding: chunked" -d "payload to send" http://example.com
您无需尝试自己创建分块编码的有效载荷。在你的情况下:
curl --data "user=mehran" --header "Transfer-Encoding: chunked" "http://172.16.17.10/pg3.php"
足够curl
发送:
POST / HTTP/1.1
...
Transfer-Encoding: chunked
Content-Type: application/x-www-form-urlencoded
b
user=mehran
0
这是 pg3.php 的 PHP 代码:
<html>
<body>
<form method="post" action="pg3.php">
<h2><font color="red">::Welcome to Server1: 172.16.24.150::</font></h2>
<input type="text" name="user">
<input type="submit" value="Submit">
</body>
</html>
<?php
if(!empty($_POST["user"])){
echo $_POST["user"];
}
?>
我发送了以下请求:
curl --data "8\r\nuser=mehran\r\n0\r\n" --header "Transfer-Encoding: chunked" "http://172.16.17.10/pg3.php"
我收到以下回复:
<html>
<body>
<form method="post" action="pg3.php">
<h2><font color="red">::Welcome to Server1: 172.16.24.150::</font></h2>
<input type="text" name="user">
<input type="submit" value="Submit">
</body>
</html>
如上所示,user=meh 不在响应中,但如果 Transfer-Encoding 正常工作,它必须存在。
有什么问题?? TNX.
参见this example in the documentation:
You send a chunked POST with curl like this:
curl -H "Transfer-Encoding: chunked" -d "payload to send" http://example.com
您无需尝试自己创建分块编码的有效载荷。在你的情况下:
curl --data "user=mehran" --header "Transfer-Encoding: chunked" "http://172.16.17.10/pg3.php"
足够curl
发送:
POST / HTTP/1.1
...
Transfer-Encoding: chunked
Content-Type: application/x-www-form-urlencoded
b
user=mehran
0