Date: Mon, 10 Feb 2014 16:28:49 -0800 From: John-Mark Gurney <jmg@funkthat.com> To: Dave Mischler <dave@mischler.com> Cc: freebsd-stable@freebsd.org Subject: Re: Is "nc" broken in 10.0? Message-ID: <20140211002849.GI34851@funkthat.com> In-Reply-To: <1392077771.9826.4.camel@barrel.mischler.com> References: <1392077771.9826.4.camel@barrel.mischler.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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."
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140211002849.GI34851>
