From owner-freebsd-hackers Sun Oct 4 08:30:49 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id IAA19262 for freebsd-hackers-outgoing; Sun, 4 Oct 1998 08:30:49 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from david.siemens.de (david.siemens.de [192.35.17.14]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id IAA19256 for ; Sun, 4 Oct 1998 08:30:46 -0700 (PDT) (envelope-from andre.albsmeier@mchp.siemens.de) X-Envelope-Sender-Is: andre.albsmeier@mchp.siemens.de (at relayer david.siemens.de) Received: from mail.siemens.de (salomon.siemens.de [139.23.33.13]) by david.siemens.de (8.9.1a/8.9.1) with ESMTP id RAA23786 for ; Sun, 4 Oct 1998 17:30:20 +0200 (MET DST) Received: from curry.mchp.siemens.de (daemon@curry.mchp.siemens.de [146.180.31.23]) by mail.siemens.de (8.9.1a/8.9.1) with ESMTP id RAA17759 for ; Sun, 4 Oct 1998 17:30:21 +0200 (MET DST) Received: (from daemon@localhost) by curry.mchp.siemens.de (8.8.8/8.8.8) id RAA02534 for ; Sun, 4 Oct 1998 17:30:21 +0200 (CEST) From: Andre Albsmeier Message-Id: <199810041530.RAA23757@internal> Subject: Re: Only "fetch -b" works, what am I doing wrong? In-Reply-To: from Marc Slemko at "Oct 2, 1998 8:26:19 am" To: marcs@znep.com (Marc Slemko) Date: Sun, 4 Oct 1998 17:30:09 +0200 (CEST) Cc: andre.albsmeier@mchp.siemens.de, hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL43 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Transfer-Encoding: 7bit Content-Transfer-Encoding: 7bit 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. You were right. I didn't handle my select() loop properly. Thanks for the help, -Andre To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message