Is "nc" broken in 10.0?
John-Mark Gurney
jmg at funkthat.com
Tue Feb 11 00:28:51 UTC 2014
Dave Mischler wrote this message on Mon, Feb 10, 2014 at 19:16 -0500:
> the 'nc' program doesn't seem to close the network connection anymore
> when it reaches EOF. This worked fine in 9.x. Can somebody else
> confirm this broken behavior?
>
> Example:
>
> On one session, listen for an incoming connection:
>
> % nc -l 5101
>
> On another session, open an outgoing connection, then close the input:
>
> % nc 127.0.0.1 5101
> ^D
>
> The session will not close. It doesn't seem to matter if the input is a
> terminal, file, pipe, or whatever else you can think of.
I can't find the thread, but try adding the -N flag to nc:
-N shutdown(2) the network socket after EOF on the input. Some
servers require this to finish their work.
For example, if you were POST'ing to an older HTTP/1.0 website w/o a
content-length header, need this for the server to know that no more
data is coming and to process the request and send you you're response..
nc was previously broken where a local EOF would shutdown the entire
process instead of waiting for the remote side to finish sending...
for example:
cat << EOF | nc -N webserver 80
POST /cgi-bin/printenv HTTP/1.0
Host: webserver
post=data&more=info
EOF
--
John-Mark Gurney Voice: +1 415 225 5579
"All that I will do, has been done, All that I have, has not."
More information about the freebsd-stable
mailing list