From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, NICE_REPLY_A autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 1018 invoked from network); 2 Aug 2022 16:58:51 -0000 Received: from 9front.inri.net (168.235.81.73) by inbox.vuxu.org with ESMTPUTF8; 2 Aug 2022 16:58:51 -0000 Received: from mail.posixcafe.org ([45.76.19.58]) by 9front; Tue Aug 2 12:57:26 -0400 2022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posixcafe.org; s=20200506; t=1659459440; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=074gXyX4zA0YsIydqOCUPsIYj4X6LuH0XohbNaWacUc=; b=r4cdOH0D8wNfxw2Z8CaSwNNp7nCcexwZj384/bKnofqHB6pptoUY5xAgwtxPssBEwoVm2T KBUv76yvN0UcfiIm3M924SzE9FTst+gBiq4gXIcQeNq2p3P7vba2fDGYEGBw5KjYmdQi4L qEVodTtMq0LVjlNIg8XZeR1XtNgCNhw= Received: from [192.168.168.200] (161-97-228-135.lpcnextlight.net [161.97.228.135]) by mail.posixcafe.org (OpenSMTPD) with ESMTPSA id 2e2a45c4 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <9front@9front.org>; Tue, 2 Aug 2022 11:57:20 -0500 (CDT) Message-ID: Date: Tue, 2 Aug 2022 10:56:40 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Content-Language: en-US To: 9front@9front.org References: <1363970938.169268.1659459065934@office.mailbox.org> From: Jacob Moody In-Reply-To: <1363970938.169268.1659459065934@office.mailbox.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: WEB2.0 out-scaling singleton extension Subject: Re: [9front] question about httpd Reply-To: 9front@9front.org Precedence: bulk On 8/2/22 10:51, sahu@mailbox.org wrote: > Hello, > > I have looked at the code, and have a question about the redirectinit() function in /sys/src/cmd/ip/httpd/redirect.c: > > void > redirectinit(void) > { > static Biobuf *b = nil; > static Qid qid; > char *file, *line, *s, *host, *field[3]; > static char pfx[] = "http://"; > > file = "/sys/lib/httpd.rewrite"; > if(b != nil){ > if( (Bfildes(b), &qid) == 0) > return; > Bterm(b); > } > ... > } > > In which cases could b be nil? And since it appears more often in the function, what do "B" (Biobuf, Bfildes, Bterm, ...) and "Q" (Qid) stand for? > > Many thanks in advance and best regards, > sahu Note that 'b' is declared as static, meaning it will retain it's values between calls. So b will be nil on only the first call to this function, subsequent calls will have a valid pointer. --- Moody