Translating curl -v --data command
I already created a simple server in c that responds to curl requests. What I want to do now is to make the same request using normal sockets, without the abstraction of a library.
So now I am trying to translate this curl command:
λ server → curl -v --data "value=2" localhost:5000/19 * Hostname was NOT found in DNS cache * Trying 127.0.0.1... * Connected to localhost (127.0.0.1) port 5000 (#0) > POST /19 HTTP/1.1 > User-Agent: curl/7.38.0 > Host: localhost:5000 > Accept: */* > Content-Length: 7 > Content-Type: application/x-www-form-urlencoded > * upload completely sent off: 7 out of 7 bytes ... ...
Is the translation provided by -v verbose argument complete? In the request, I can only see the path 19 passed in. Where is the argument "value=2"?
Also, the camp Content-Length is set to 7. This is also strange, because the body seems to be empty. What am I getting wrong here?
What am I getting wrong here?
You failed to read the curl manual:
-v/--verbose Makes the fetching more verbose/talkative. Mostly useful for debugging. A line starting with '>' means "header data" sent by curl, '<' means "header data" received by curl that is hidden in normal cases, and a line starting with '*' means additional info provided by curl. … If you think this option still doesn't give you enough details, consider using --trace or --trace-ascii instead.
curl --trace-ascii - --data "value=2" localhost:5000/19
shows the body data.