Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 7216 invoked from network); 25 Jan 2009 21:07:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Jan 2009 21:07:07 -0000 Received: (qmail 49882 invoked by uid 500); 25 Jan 2009 21:07:00 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 49845 invoked by uid 500); 25 Jan 2009 21:07:00 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 49834 invoked by uid 99); 25 Jan 2009 21:07:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 Jan 2009 13:07:00 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of b.candler@pobox.com designates 208.72.237.25 as permitted sender) Received: from [208.72.237.25] (HELO sasl.smtp.pobox.com) (208.72.237.25) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 Jan 2009 21:06:51 +0000 Received: from localhost.localdomain (unknown [127.0.0.1]) by b-sasl-quonix.sasl.smtp.pobox.com (Postfix) with ESMTP id 2419A1D073 for ; Sun, 25 Jan 2009 16:06:25 -0500 (EST) Received: from mappit (unknown [80.45.95.114]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by b-sasl-quonix.sasl.smtp.pobox.com (Postfix) with ESMTPSA id C7C111D04A for ; Sun, 25 Jan 2009 16:06:23 -0500 (EST) Received: from brian by mappit with local (Exim 4.69) (envelope-from ) id 1LRCBS-00079t-As for user@couchdb.apache.org; Sun, 25 Jan 2009 21:06:22 +0000 Date: Sun, 25 Jan 2009 21:06:22 +0000 From: Brian Candler To: user@couchdb.apache.org Subject: Re: Issue with null MIME type for attachments Message-ID: <20090125210622.GB26564@uk.tiscali.com> References: <20090125164143.GA19119@uk.tiscali.com> <20090125202548.GL24162@tumbolia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090125202548.GL24162@tumbolia.org> User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-Pobox-Relay-ID: 067F81FA-EB24-11DD-881D-BE78113D384A-28021239!a-sasl-quonix.pobox.com X-Virus-Checked: Checked by ClamAV on apache.org On Sun, Jan 25, 2009 at 08:25:48PM +0000, Noah Slater wrote: > On Mon, Jan 26, 2009 at 06:49:53AM +1030, Antony Blakey wrote: > > Treat a supplied null as an error. > > > > If mimetype isn't supplied, use a default based on the attachment name. > > Default based on attachment name sounds misleadingly simple > > I agree that this should be the way forward but we will need to: > > * ship a custom mime.types configuration file under /etc > * know how to read the system mime.types file usually at /etc/mime.types > * know how to pick up any other user supplied mime.types file > * add configuration options for this in the ini files > > Check your local mime.types file for more hints. The format is pretty simple. For consistency, whatever logic chosen should also apply to uploads of standalone attachments without any Content-Type header. As far as I can tell using telnet, these give a badarg response at the moment. RFC 2616 allows you to guess based on extension, but also allows you to default to application/octet-stream. (7.2.1) Any HTTP/1.1 message containing an entity-body SHOULD include a Content-Type header field defining the media type of that body. If and only if the media type is not given by a Content-Type field, the recipient MAY attempt to guess the media type via inspection of its content and/or the name extension(s) of the URI used to identify the resource. If the media type remains unknown, the recipient SHOULD treat it as type "application/octet-stream". For now though, couchapp could use the ruby MIME::Types gem in place of its own hard-coded table. irb(main):008:0> MIME::Types.type_for('citydesk.xml').first.to_s => "application/xml" Regards, Brian.