From owner-freebsd-stable@FreeBSD.ORG Tue Feb 11 00:28:51 2014 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A87D3B55 for ; Tue, 11 Feb 2014 00:28:51 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 69BBE1AF9 for ; Tue, 11 Feb 2014 00:28:50 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id s1B0Sosb040034 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 10 Feb 2014 16:28:50 -0800 (PST) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id s1B0Snbt040033; Mon, 10 Feb 2014 16:28:49 -0800 (PST) (envelope-from jmg) Date: Mon, 10 Feb 2014 16:28:49 -0800 From: John-Mark Gurney To: Dave Mischler Subject: Re: Is "nc" broken in 10.0? Message-ID: <20140211002849.GI34851@funkthat.com> Mail-Followup-To: Dave Mischler , freebsd-stable@freebsd.org References: <1392077771.9826.4.camel@barrel.mischler.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1392077771.9826.4.camel@barrel.mischler.com> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Mon, 10 Feb 2014 16:28:50 -0800 (PST) Cc: freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Feb 2014 00:28:51 -0000 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."