From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/68951 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.gnus.general Subject: Re: application/octet-stream sent as 7bit Date: Thu, 03 Sep 2009 20:28:04 +0900 Organization: Emacsen advocacy group Message-ID: References: <87zl9hpgeu.fsf@paduch.telenet.ru> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1251977400 24842 80.91.229.12 (3 Sep 2009 11:30:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Sep 2009 11:30:00 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M17369@lists.math.uh.edu Thu Sep 03 13:29:52 2009 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.50) id 1MjAVk-00040a-3Y for ding-account@gmane.org; Thu, 03 Sep 2009 13:29:52 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1MjAUt-0004Mu-4k; Thu, 03 Sep 2009 06:28:59 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1MjAUm-0004Mh-EV for ding@lists.math.uh.edu; Thu, 03 Sep 2009 06:28:52 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.69) (envelope-from ) id 1MjAUk-0008BW-Bm for ding@lists.math.uh.edu; Thu, 03 Sep 2009 06:28:51 -0500 Original-Received: from orlando.hostforweb.net ([216.246.45.90]) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1MjAVL-0001L6-00 for ; Thu, 03 Sep 2009 13:29:27 +0200 Original-Received: from localhost ([127.0.0.1]:40041) by orlando.hostforweb.net with esmtpa (Exim 4.69) (envelope-from ) id 1MjAU5-0004zF-0y for ding@gnus.org; Thu, 03 Sep 2009 06:28:09 -0500 X-Hashcash: 1:20:090903:ding@gnus.org::GmOcJqjIZv4K0Eo4:00003GDK X-Face: #kKnN,xUnmKia.'[pp`;Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu;B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (gnu/linux) Cancel-Lock: sha1:iaV7z88EZs24vu1VTUCS5vyh6j4= X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - orlando.hostforweb.net X-AntiAbuse: Original Domain - gnus.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: -2.6 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:68951 Archived-At: --=-=-= >>>>> Dmitri Paduchikh wrote: > In some cases Gnus sends application/octet-stream attachments in > unencoded form: > ,---- >| --=-=-= >| Content-Type: application/octet-stream >| Content-Disposition: attachment; filename=test.sh >| >| #!/bin/sh >| echo test > `---- > I am concerned that contents can change when transferring a message. > Think of EOL conversions, ">From " stuff, etc. Such changes can corrupt > shell script, for example. > In general, RFC 2046 says that application/octet-stream denotes > arbitrary binary data. For arbitrary binary data I would expect that it > is transferred exactly as is, even if it looks like a 7-bit text. Agreed. Aren't there any other application/* types that should not be forced to be encoded by 7bit? Otherwise, is it better not to force the 7bit encoding to all application/* types? Here are two patches; one is for excluding application/octet-stream, the other is for excluding application/*. --=-=-= Content-Type: text/x-patch Content-Disposition: inline --- mm-encode.el~ 2009-01-22 08:09:02 +0000 +++ mm-encode.el 2009-09-03 11:24:11 +0000 @@ -148,9 +148,11 @@ (mm-content-transfer-encoding mime-type))) (bits (mm-body-7-or-8))) ;; We force buffers that are 7bit to be unencoded, no matter - ;; what the preferred encoding is. - ;; Only if the buffers don't contain lone lines. - (when (and (eq bits '7bit) (not (mm-long-lines-p 76))) + ;; what the preferred encoding is, except that the MIME-type is + ;; application/octet-stream or the buffers contain long lines. + (when (and (eq bits '7bit) + (not (string-equal mime-type "application/octet-stream")) + (not (mm-long-lines-p 76))) (setq encoding bits)) (mm-encode-content-transfer-encoding encoding mime-type) encoding)) --=-=-= Content-Disposition: inline --=-=-= Content-Type: text/x-patch Content-Disposition: inline --- mm-encode.el~ 2009-01-22 08:09:02 +0000 +++ mm-encode.el 2009-09-03 11:24:11 +0000 @@ -148,9 +148,11 @@ (mm-content-transfer-encoding mime-type))) (bits (mm-body-7-or-8))) ;; We force buffers that are 7bit to be unencoded, no matter - ;; what the preferred encoding is. - ;; Only if the buffers don't contain lone lines. - (when (and (eq bits '7bit) (not (mm-long-lines-p 76))) + ;; what the preferred encoding is, except that the MIME-type is + ;; any application/* type or the buffers contain long lines. + (when (and (eq bits '7bit) + (not (string-match "\\`application/" mime-type)) + (not (mm-long-lines-p 76))) (setq encoding bits)) (mm-encode-content-transfer-encoding encoding mime-type) encoding)) --=-=-=--