From owner-freebsd-hackers Fri Oct 2 08:32:06 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id IAA15953 for freebsd-hackers-outgoing; Fri, 2 Oct 1998 08:32:06 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from redfish.go2net.com (redfish.go2net.com [207.178.55.5]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id IAA15852 for ; Fri, 2 Oct 1998 08:31:30 -0700 (PDT) (envelope-from marcs@go2net.com) Received: from marcs by redfish.go2net.com with smtp (Exim 1.82 #2) id 0zP763-0001ID-00; Fri, 2 Oct 1998 08:26:19 -0700 Date: Fri, 2 Oct 1998 08:26:19 -0700 (PDT) From: Marc Slemko X-Sender: marcs@redfish To: Andre Albsmeier cc: hackers@FreeBSD.ORG Subject: Re: Only "fetch -b" works, what am I doing wrong? In-Reply-To: <199810020730.JAA05992@internal> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, 2 Oct 1998, Andre Albsmeier wrote: > Hi, > > I have written a small programm that serves http requests. > When using fetch I have to use "fetch -b" because without > -b fetch complains with: "fetch: empty reply from myserver.org" > > While digging around in http.c, I found out that -b > works around a linux bug. One of the correspondig > lines is: > > if (sendmsg(s, &msg, fs->fs_linux_bug ? 0 : MSG_EOF) < 0) { > > This means, my small http server works when setting flags > (of sendmsg) to 0. I assume, the correct way would be to set > MSG_EOF but somehow my http server doesn't work with it. You are not dealing properly with the case where the client half closes the connection before the response is fully sent. It shouldn't be too hard to add some debugging to your code to verify exactly where the problem is coming up, if your server is incorrectly assuming that if the socket is half closed it should abort, etc. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message