0

Here is the PHP code for 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>

<?php

if(!empty($_POST["user"])){

  echo $_POST["user"];

}

?>

I sent the following request:

curl --data "8\r\nuser=mehran\r\n0\r\n" --header "Transfer-Encoding: chunked" "http://172.16.17.10/pg3.php"

I got the following response:

<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>

As the above shows, user=meh is not in the response, while it must be there if Transfer-Encoding works correctly.

What's the problem?? TNX.

1 Answer 1

0

See 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

You don't need to try to create the chunked encoded payload yourself. In your case:

curl --data "user=mehran" --header "Transfer-Encoding: chunked" "http://172.16.17.10/pg3.php"

is enough for curl to send:

POST / HTTP/1.1
...
Transfer-Encoding: chunked
Content-Type: application/x-www-form-urlencoded

b
user=mehran
0

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Joe. That's the case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.