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 autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 15073 invoked from network); 8 Jun 2021 10:37:15 -0000 Received: from 1ess.inri.net (216.126.196.35) by inbox.vuxu.org with ESMTPUTF8; 8 Jun 2021 10:37:15 -0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by 1ess; Mon Jun 7 05:24:14 -0400 2021 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 34A365C0182; Mon, 7 Jun 2021 05:24:12 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 07 Jun 2021 05:24:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=biobuf.link; h= message-id:from:date:subject:to:mime-version:content-type :content-transfer-encoding; s=fm2; bh=uC0TVF3/zQPSat/4wBDsuWxfVj +ThdffRRJvLBLwQ4M=; b=dCOJmULLU1enmAqWgbPWTZGeh60Cq3HGJgP0TKMxeb pD+WVO82MZrVS2UzSg/K3nr5aDPHqUoblTJvRV5gksPFdlgTh8D81bPb+HnrNXya 2UPZ6cL1YrM9UL0biXFjmO8hQpP4SDfHLhy7hB/1Mq8otURTD4Tv3MLDNficwxcy goOjkN2YjOU1f0SJ7Zlgpm5cV0GPfsvx4/kIg3HIH/CWUCzN8nt2VNKD4QmnKI51 aTfaQISOsc69+VZInyLZnPw4ZvqRerB7m21z8irp5cLvMZR0FzZXURdhTTEeozgt Y8iRkg8PFOlgxhV5m10Nd/ZA5KrqausHJV8liHm15TDQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=uC0TVF 3/zQPSat/4wBDsuWxfVj+ThdffRRJvLBLwQ4M=; b=qsD5StVsbRzvIUBg+jNEBI kqtAapM1RKbF/2iF8ppNv/e9qv/OaScdd2QOoiFXEK9BUI5Jk8Fzsy0QgsOlgP/Y N75uPWl3QOdHSsTvc6TspsbSZCtmWmQwHKFe7dnsqRtHGQ8rQKRHC0DDlBrwa12r wMZONNO1e9yN/eizJp3pkjjFEYtX65Y8fbtRLGAY/ax/1SJPUikU5bf2GGkN1zCF dPd3Wu7YevXOPrrXxKERmgRQP7V+j2VV+Xp5ITCknnOEI+NSKo79rxvZqI5PsW3V qPOjWYHXmE0c1Fylm95vNl+Yrm4G40mrudfqfUKF6yRjlA+O+iWvy+Vshjj8ywxA == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedtjedgudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefkhfffuffvgggtgfesthejjedttd dtvdenucfhrhhomhepjhgrmhgvshcuphgrlhhmvghruceojhgrmhgvshessghiohgsuhhf rdhlihhnkheqnecuggftrfgrthhtvghrnhepffduffellefgudehgfevtefgieelheeufe euffdtgeeltdetfeeiveeitddvgfehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomhepjhgrmhgvshessghiohgsuhhfrdhlihhnkh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA for <9front@9front.org>; Mon, 7 Jun 2021 05:24:11 -0400 (EDT) Message-ID: <07270CC0D7E95F9E37CE20FABE03BD7C@biobuf.link> From: james palmer Date: Mon, 07 Jun 2021 09:13:51 +0000 To: 9front@9front.org MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: interface-oriented polling information-based callback backend Subject: [9front] [PATCH] mothra: read the content-type header instead of using file(1) to determine type Reply-To: 9front@9front.org Precedence: bulk this fixes some pages being classified as xml by file(1), meaning they would be rendered as plain text rather than as html. if the header is not present mothra will fall back to using file(1). --- diff 56656a7ac6aac082b65d77cf0a0e4bc492ddcd2c 3ec67240f59d1e68b8d7fcb30fa17fe87f317bff --- a/sys/src/cmd/mothra/mothra.c Mon Jun 7 10:01:32 2021 +++ b/sys/src/cmd/mothra/mothra.c Mon Jun 7 10:13:51 2021 @@ -1017,8 +1017,9 @@ message("getting %s", selection->fullname); if(mothmode && !plumb) typ = -1; - else + else if((typ = mimetotype(selection->contenttype)) < 0) typ = snooptype(fd); + switch(typ){ default: if(plumb){ --- a/sys/src/cmd/mothra/mothra.h Mon Jun 7 10:01:32 2021 +++ b/sys/src/cmd/mothra/mothra.h Mon Jun 7 10:13:51 2021 @@ -28,6 +28,7 @@ char *reltext; char fullname[NNAME]; char tag[NNAME]; + char contenttype[NNAME]; int map; /* is this an image map? */ }; struct Www{ @@ -97,6 +98,7 @@ #pragma varargck type "U" char* void message(char *, ...); int filetype(int, char *, int); +int mimetotype(char *); int snooptype(int); void mkfieldpanel(Rtext *); void geturl(char *, int, int, int); --- a/sys/src/cmd/mothra/snoop.c Mon Jun 7 10:01:32 2021 +++ b/sys/src/cmd/mothra/snoop.c Mon Jun 7 10:13:51 2021 @@ -87,8 +87,9 @@ } int -snooptype(int fd) +mimetotype(char *mime) { + int i; static struct { char *typ; int val; @@ -110,13 +111,23 @@ "image/", PAGE, "text/", PLAIN, "message/rfc822", PLAIN, - }; + }; + + for(i=0; itag, sizeof(url->tag)); + + snprint(buf+n, sizeof(buf)-n, "/contenttype"); + readstr(buf, url->contenttype, sizeof(url->contenttype)); snprint(buf+n, sizeof(buf)-n, "/contentencoding"); readstr(buf, buf, sizeof(buf));