I run the following http echo server. In its response, it does not have the Content-Length header.
$ http-echo-server 3005
https://www.npmjs.com/package/http-echo-server
When I run curl, I see this. It waits at "mydata" a short period of time, then terminate. How does curl know whether the incoming request is finished or not?
The same thing occurs for wget. How does wget determine when to terminate?
$ curl -D /dev/stdout -d mydata$'\n' 127.0.0.1:3005
HTTP/1.1 200 OK
Date: Wed Mar 31 2021 15:14:39 GMT-0400 (Eastern Daylight Time)
Connection: close
Content-Type: text/plain
Access-Control-Allow-Origin: *
POST / HTTP/1.1
Host: 127.0.0.1:3005
User-Agent: curl/7.74.0
Accept: */*
Content-Length: 7
Content-Type: application/x-www-form-urlencoded
mydata
$ wget -S -qO- --post-data mydata$'\n' 127.0.0.1:3005
HTTP/1.1 200 OK
Date: Wed Mar 31 2021 15:18:44 GMT-0400 (Eastern Daylight Time)
Connection: close
Content-Type: text/plain
Access-Control-Allow-Origin: *
POST / HTTP/1.1
User-Agent: Wget/1.21
Accept: */*
Accept-Encoding: identity
Host: 127.0.0.1:3005
Connection: Keep-Alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 7
mydata