From unknown Fri Aug 15 12:50:54 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#16198 <16198@debbugs.gnu.org> To: bug#16198 <16198@debbugs.gnu.org> Subject: Status: 24.3.50; [PATCH 1/2] eww: Does not support file upload. Reply-To: bug#16198 <16198@debbugs.gnu.org> Date: Fri, 15 Aug 2025 19:50:54 +0000 retitle 16198 24.3.50; [PATCH 1/2] eww: Does not support file upload. reassign 16198 emacs submitter 16198 Kenjiro NAKAYAMA severity 16198 normal tag 16198 fixed patch thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 20 04:30:14 2013 Received: (at submit) by debbugs.gnu.org; 20 Dec 2013 09:30:14 +0000 Received: from localhost ([127.0.0.1]:59508 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VtwPN-00012V-PU for submit@debbugs.gnu.org; Fri, 20 Dec 2013 04:30:14 -0500 Received: from eggs.gnu.org ([208.118.235.92]:45538) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VtwPL-00012M-9b for submit@debbugs.gnu.org; Fri, 20 Dec 2013 04:30:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VtwPC-0003H7-Ne for submit@debbugs.gnu.org; Fri, 20 Dec 2013 04:30:11 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:37140) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtwPC-0003Gr-Jy for submit@debbugs.gnu.org; Fri, 20 Dec 2013 04:30:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtwP3-0005ch-T9 for bug-gnu-emacs@gnu.org; Fri, 20 Dec 2013 04:30:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VtwOv-000371-G6 for bug-gnu-emacs@gnu.org; Fri, 20 Dec 2013 04:29:53 -0500 Received: from mail-pa0-x22c.google.com ([2607:f8b0:400e:c03::22c]:52352) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtwOv-00036r-8V for bug-gnu-emacs@gnu.org; Fri, 20 Dec 2013 04:29:45 -0500 Received: by mail-pa0-f44.google.com with SMTP id fa1so2407529pad.3 for ; Fri, 20 Dec 2013 01:29:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=user-agent:from:to:subject:date:message-id:mime-version :content-type; bh=drrzlWRsoVxArEnkbhYVQ6Qx5VQvno05/+uBuzooKXM=; b=erA/ObMFFC2eRQApb7V9ftAvz8oRJVWfvavFXjNZId1iaQDBglBoCIHsBzrOja2LEm 3Au730fMHnPyq1UoUSpZnJheN9V54kbUMVVkKrx1IB2hsbGng+pBLNr0Evsexdgg0viG TohfrzGcI3F9t1FO6OAtLcK9x2VUTbPto77h3BX3Z8Mk6EteUTX3BQqvX1MQVFIwlheW 2dkiAHenV5hqu5FswZTgZTudYwVfAHNRgc1D+QddxuGWL7ySaX20H89OmTUsnjjRJRj2 CLAAro6Qn4ZtJBy8r8ggjum69Fw9xPaqb9VpES+gLeE48zRIzIgczppFqM5s9sD02if+ t8Yg== X-Received: by 10.66.159.234 with SMTP id xf10mr7326395pab.139.1387531784036; Fri, 20 Dec 2013 01:29:44 -0800 (PST) Received: from dhcp-193-97.nrt.redhat.com (nat-pool-nrt-t1.redhat.com. [66.187.238.10]) by mx.google.com with ESMTPSA id xs1sm16909407pac.7.2013.12.20.01.29.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2013 01:29:43 -0800 (PST) User-agent: mu4e 0.9.9.6pre2; emacs 24.3.50.1 From: Kenjiro NAKAYAMA To: bug-gnu-emacs@gnu.org Subject: 24.3.50; [PATCH 1/2] eww: Does not support file upload. Date: Fri, 20 Dec 2013 18:29:37 +0900 Message-ID: <87fvpnzx8e.fsf@dhcp-193-97.nrt.redhat.com> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) This report includes a patch to eww file upload. Please, review and install it to the official tree if appreciated. * Issue Since Eww does not support file upload(input with type="file"), following HTML can not display and handle properly. example:
Kenjiro NAKAYAMA Signed-off-by: Kenjiro NAKAYAMA * gnus/mm-url.el (mm-url-encode-multipart-form-data): Restore to handle "maltipart/form-data" by eww. * net/eww.el(eww-form-file(defface)): New defface of file upload form. (eww-submit-file): New key map of file upload. (eww-form-file): New file upload button and file name context. (eww-select-file): Select file and display selected file name. (eww-tag-input): Handle input tag of file type. (eww-update-field): Add point offset. (eww-submit): Add submit with multipart/form-data. --- lisp/gnus/mm-url.el | 44 +++++++++++++++++++++ lisp/net/eww.el | 108 +++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 138 insertions(+), 14 deletions(-) diff --git a/lisp/gnus/mm-url.el b/lisp/gnus/mm-url.el index 6e83b18..b8a4d46 100644 --- a/lisp/gnus/mm-url.el +++ b/lisp/gnus/mm-url.el @@ -416,6 +416,50 @@ spaces. Die Die Die." (autoload 'mml-compute-boundary "mml") +(defun mm-url-encode-multipart-form-data (pairs &optional boundary) + "Return PAIRS encoded in multipart/form-data." + ;; RFC1867 + ;; Get a good boundary + (unless boundary + (setq boundary (mml-compute-boundary '()))) + (concat + ;; Start with the boundary + "--" boundary "\r\n" + ;; Create name value pairs + (mapconcat + 'identity + ;; Delete any returned items that are empty + (delq nil + (mapcar (lambda (data) + (cond ((equal (car data) "file") + ;; For each pair + (concat + ;; Encode the name + "Content-Disposition: form-data; name=\"" (cdr (assoc "name" (cdr data))) "\"; filename=\"" (cdr (assoc "filename" (cdr data))) "\"\r\n" + "Content-Type: text/plain; charset=utf-8\r\n" + "Content-Transfer-Encoding: binary\r\n\r\n" + (cond ((stringp (cdr (assoc "filedata" (cdr data)))) + (cdr (assoc "filedata" (cdr data)))) + ((integerp (cdr (assoc "filedata" (cdr data)))) + (int-to-string (cdr (assoc "filedata" (cdr data)))))) + "\r\n")) + ((equal (car data) "submit") + (concat + "Content-Disposition: form-data; name=\"submit\"\r\n\r\n" + "Submit" + )) + (t + (concat + "Content-Disposition: form-data;name=" (car data) "\r\n\r\n" + (concat (mm-url-form-encode-xwfu (cdr data)) + ))) + )) + pairs)) + ;; use the boundary as a separator + (concat "\r\n--" boundary "\r\n")) + ;; put a boundary at the end. + "--" boundary "--\r\n")) + (defun mm-url-remove-markup () "Remove all HTML markup, leaving just plain text." (goto-char (point-min)) From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 21 15:26:36 2013 Received: (at 16198) by debbugs.gnu.org; 21 Dec 2013 20:26:36 +0000 Received: from localhost ([127.0.0.1]:33632 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuT87-00033s-PV for submit@debbugs.gnu.org; Sat, 21 Dec 2013 15:26:36 -0500 Received: from mail-qe0-f54.google.com ([209.85.128.54]:33247) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuT85-00033j-7E for 16198@debbugs.gnu.org; Sat, 21 Dec 2013 15:26:33 -0500 Received: by mail-qe0-f54.google.com with SMTP id cy11so3856364qeb.27 for <16198@debbugs.gnu.org>; Sat, 21 Dec 2013 12:26:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lifelogs.com; s=google; h=from:to:cc:subject:organization:references:mail-copies-to :gmane-reply-to-list:date:in-reply-to:message-id:user-agent :mime-version:content-type; bh=SUXoyTb36MhNkn7kgNSdvLSp56vUP2TMOeqluQqMDk0=; b=oo+eXOO8vBSXdXr0mZIxeDME4PKPEwArVrq8rMRQ3eY599KGePvD5kXFTXnbWjDS82 twDBUgAkl9WngPt9gjlxKNWmhR7XwkhRHTqYeO+3ug63DYLxHAwSK5aI90UG8r0ZJ/uF jyyCcJdcGyTStut54mPAja108Bl5FmPwgtlGo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:organization:references :mail-copies-to:gmane-reply-to-list:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=SUXoyTb36MhNkn7kgNSdvLSp56vUP2TMOeqluQqMDk0=; b=KhaPSY+lxdXQx81esTwxcxs5mz3VMjqMDZbVebwZpn7QemHCZxE1VNLD9cJM9uxcym /Sug1Gjej3z2BUM90+yQOuzJ4EOb/xu9i3nXRd0sshOIpOi0KT+Xu+oK9Ho300bnrJAo BuHhyv7N433sxqnNRpkrV5ixHWAOZKLAo3nrDPViLYjzCOJ6jNyvGa8eHdTExaiMKwYX uHupxK0/Tn3UCNMHF7D7gLgUFcCIbgow1Tuu26KnaqYnJ0VOKcrmbxjVPcvSzrFLHJwG d/3DTnwTde0tfpOJJKU5NpAWEZGu0V7XVPJ2FoqIWkCniqy77G4qm9dK8kryVXR5yjl5 FtjA== X-Gm-Message-State: ALoCoQkLKCVv9YzpIVk78sCOaFFP5VuLuIX6mPOMhkfVypiodrEIjwQ59puxtiGuxtk65jIRSKnd X-Received: by 10.224.73.200 with SMTP id r8mr27294567qaj.72.1387657592640; Sat, 21 Dec 2013 12:26:32 -0800 (PST) Received: from flea.lifelogs.com (c-98-229-61-72.hsd1.ma.comcast.net. [98.229.61.72]) by mx.google.com with ESMTPSA id r9sm13483546qey.19.2013.12.21.12.26.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Dec 2013 12:26:32 -0800 (PST) From: Ted Zlatanov To: Kenjiro NAKAYAMA , Lars Magne Ingebrigtsen Subject: Re: bug#16198: 24.3.50; [PATCH 1/2] eww: Does not support file upload. Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos References: <87fvpnzx8e.fsf@dhcp-193-97.nrt.redhat.com> X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Mail-Copies-To: never Gmane-Reply-To-List: yes Date: Sat, 21 Dec 2013 15:27:53 -0500 In-Reply-To: <87fvpnzx8e.fsf@dhcp-193-97.nrt.redhat.com> (Kenjiro NAKAYAMA's message of "Fri, 20 Dec 2013 18:29:37 +0900") Message-ID: <8761qidk52.fsf@flea.lifelogs.com> User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 16198 Cc: 16198@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Fri, 20 Dec 2013 18:29:37 +0900 Kenjiro NAKAYAMA wrote: KN> This report includes a patch to eww file upload. Please, review and KN> install it to the official tree if appreciated. KN> * Issue KN> Since Eww does not support file upload(input with type="file"), following KN> HTML can not display and handle properly. KN> example: KN>
KN> KN> KN>
This looks like a good change but I'm not comfortable installing it, it's too deep and affects Gnus as well, and I don't know the MIME pieces in Gnus. I'll let Lars review it. Ted From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 24 02:39:10 2013 Received: (at 16198) by debbugs.gnu.org; 24 Dec 2013 07:39:10 +0000 Received: from localhost ([127.0.0.1]:37549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VvMa5-0000Xj-Ae for submit@debbugs.gnu.org; Tue, 24 Dec 2013 02:39:09 -0500 Received: from hermes.netfonds.no ([80.91.224.195]:35491) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VvMa2-0000XT-AQ for 16198@debbugs.gnu.org; Tue, 24 Dec 2013 02:39:07 -0500 Received: from 77.18.245.69.tmi.telenormobil.no ([77.18.245.69] helo=building.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1VvMZn-0007Tu-It; Tue, 24 Dec 2013 08:38:51 +0100 From: Lars Ingebrigtsen To: Kenjiro NAKAYAMA Subject: Re: bug#16198: 24.3.50; [PATCH 1/2] eww: Does not support file upload. References: <87fvpnzx8e.fsf@dhcp-193-97.nrt.redhat.com> Date: Tue, 24 Dec 2013 08:32:56 +0100 In-Reply-To: <87fvpnzx8e.fsf@dhcp-193-97.nrt.redhat.com> (Kenjiro NAKAYAMA's message of "Fri, 20 Dec 2013 18:29:37 +0900") Message-ID: <87ha9yzot3.fsf@building.gnus.org> User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-MailScanner-ID: 1VvMZn-0007Tu-It X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1388475532.25518@NSNWDS+MvECPsuovQx0NEA X-Spam-Status: No X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 16198 Cc: 16198@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Kenjiro NAKAYAMA writes: > This report includes a patch to eww file upload. Please, review and > install it to the official tree if appreciated. It sounds like useful functionality, but Emacs went into feature freeze yesterday, so it'll have to wait until Emacs thaws again. Comment about the code: > + (concat > + "Content-Disposition: form-data;name=" (car data) "\r\n\r\n" > + (concat (mm-url-form-encode-xwfu (cdr data)) > + ))) > + )) This is not the Emacs parenthesis style. All the closing parentheses should be on the same line. And there's a superfluous `concat' there... -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/ From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 24 02:39:28 2013 Received: (at control) by debbugs.gnu.org; 24 Dec 2013 07:39:29 +0000 Received: from localhost ([127.0.0.1]:37552 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VvMaN-0000YQ-IC for submit@debbugs.gnu.org; Tue, 24 Dec 2013 02:39:28 -0500 Received: from hermes.netfonds.no ([80.91.224.195]:35512) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VvMaJ-0000YD-Hy for control@debbugs.gnu.org; Tue, 24 Dec 2013 02:39:25 -0500 Received: from 77.18.245.69.tmi.telenormobil.no ([77.18.245.69] helo=building.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1VvMa6-0007Us-Af for control@debbugs.gnu.org; Tue, 24 Dec 2013 08:39:10 +0100 Date: Tue, 24 Dec 2013 08:33:15 +0100 Message-Id: <87fvpizosk.fsf@building.gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #16198 X-MailScanner-ID: 1VvMa6-0007Us-Af X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1388475550.90237@fxWvN+qfIA/KYTqpUiKm4A X-Spam-Status: No X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) tags 16198 pending From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 24 23:29:50 2013 Received: (at 16198) by debbugs.gnu.org; 25 Dec 2013 04:29:50 +0000 Received: from localhost ([127.0.0.1]:40205 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vvg6L-0003UJ-KE for submit@debbugs.gnu.org; Tue, 24 Dec 2013 23:29:49 -0500 Received: from mail-pd0-f178.google.com ([209.85.192.178]:34577) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vvg6E-0003Tw-IC for 16198@debbugs.gnu.org; Tue, 24 Dec 2013 23:29:42 -0500 Received: by mail-pd0-f178.google.com with SMTP id y10so6885989pdj.37 for <16198@debbugs.gnu.org>; Tue, 24 Dec 2013 20:29:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version:content-type; bh=ti6CFMh1ag7wx6puCjfMQZa35CseCDdqvhUD0r0zgJg=; b=YpMQro9swD1bkRXJg0MIpGHcXPTv6LaieFOJ0ZZaxuUBOwQGUSHqsaNcCzeQ5oHvSQ YiUIf20bt1JHuPQr/SOYbdUimLDpnZO/bWqFbVevZW/VsW7bup1gNoSoFiLI5c5YWdk5 tClO496OMgjZTL2vKSejnO/VzAyHt6nVD37KOQwyIoZzXWc2qgkUM6q4SPTyXkrQAQgR apFtoDGU6RfNcu6H9gm4rDZv5tZnaKrjs0bljp6Y+iPOHC+1kWsIR0TO2uHsJv3IV8du PG8jecFMd876Ux8dPw3z2OraUMtezYU/lZQl3hR013G4Kdm95o3s1k7UJ1lXWI6KVdxp Jc7Q== X-Received: by 10.66.140.40 with SMTP id rd8mr36503376pab.119.1387945777652; Tue, 24 Dec 2013 20:29:37 -0800 (PST) Received: from dhcp-193-97.nrt.redhat.com (nat-pool-nrt-u1.redhat.com. [66.187.238.11]) by mx.google.com with ESMTPSA id dq3sm45309182pbc.35.2013.12.24.20.29.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Dec 2013 20:29:36 -0800 (PST) References: <87fvpnzx8e.fsf@dhcp-193-97.nrt.redhat.com> <87ha9yzot3.fsf@building.gnus.org> User-agent: mu4e 0.9.9.6pre2; emacs 24.3.50.2 From: Kenjiro NAKAYAMA To: Lars Ingebrigtsen Subject: Re: bug#16198: 24.3.50; [PATCH 1/2] eww: Does not support file upload. In-reply-to: <87ha9yzot3.fsf@building.gnus.org> Date: Wed, 25 Dec 2013 13:29:29 +0900 Message-ID: <87ob457due.fsf@dhcp-193-97.nrt.redhat.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 16198 Cc: Kenjiro NAKAYAMA , 16198@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) > This is not the Emacs parenthesis style. All the closing parentheses > should be on the same line. And there's a superfluous `concat' there... Thank you Lars and Ted, Since I fixed the patches, I send again. Signed-off-by: Kenjiro NAKAYAMA * gnus/mm-url.el (mm-url-encode-multipart-form-data): Restore to handle "maltipart/form-data" by eww. * net/eww.el(eww-form-file(defface)): New defface of file upload form. (eww-submit-file): New key map of file upload. (eww-form-file): New file upload button and file name context. (eww-select-file): Select file and display selected file name. (eww-tag-input): Handle input tag of file type. (eww-update-field): Add point offset. (eww-submit): Add submit with multipart/form-data. --- lisp/gnus/mm-url.el | 45 +++++++++++++++++++++++-- lisp/net/eww.el | 97 +++++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 126 insertions(+), 16 deletions(-) diff --git a/lisp/gnus/mm-url.el b/lisp/gnus/mm-url.el index 6e83b18..9deb160 100644 --- a/lisp/gnus/mm-url.el +++ b/lisp/gnus/mm-url.el @@ -416,13 +416,54 @@ spaces. Die Die Die." (autoload 'mml-compute-boundary "mml") +(defun mm-url-encode-multipart-form-data (pairs &optional boundary) + "Return PAIRS encoded in multipart/form-data." + ;; RFC1867 + ;; Get a good boundary + (unless boundary + (setq boundary (mml-compute-boundary '()))) + (concat + ;; Start with the boundary + "--" boundary "\r\n" + ;; Create name value pairs + (mapconcat + 'identity + ;; Delete any returned items that are empty + (delq nil + (mapcar (lambda (data) + (cond ((equal (car data) "file") + ;; For each pair + (concat + ;; Encode the name + "Content-Disposition: form-data; name=\"" (cdr (assoc "name" (cdr data))) "\"; filename=\"" (cdr (assoc "filename" (cdr data))) "\"\r\n" + "Content-Type: text/plain; charset=utf-8\r\n" + "Content-Transfer-Encoding: binary\r\n\r\n" + (cond ((stringp (cdr (assoc "filedata" (cdr data)))) + (cdr (assoc "filedata" (cdr data)))) + ((integerp (cdr (assoc "filedata" (cdr data)))) + (int-to-string (cdr (assoc "filedata" (cdr data)))))) + "\r\n")) + ((equal (car data) "submit") + (concat + "Content-Disposition: form-data; name=\"submit\"\r\n\r\n" + "Submit")) + (t + (concat + "Content-Disposition: form-data;name=" (car data) "\r\n\r\n" + (mm-url-form-encode-xwfu (cdr data)))))) + pairs)) + ;; use the boundary as a separator + (concat "\r\n--" boundary "\r\n")) + ;; put a boundary at the end. + "--" boundary "--\r\n")) + (defun mm-url-remove-markup () "Remove all HTML markup, leaving just plain text." (goto-char (point-min)) (while (search-forward "" nil t) - (point-max)))) + (or (search-forward "-->" nil t) + (point-max)))) (goto-char (point-min)) (while (re-search-forward "<[^>]+>" nil t) (replace-match "" t t))) --- [1/2] --- larsi@gnus.org writes: > Kenjiro NAKAYAMA writes: > >> This report includes a patch to eww file upload. Please, review and >> install it to the official tree if appreciated. > > It sounds like useful functionality, but Emacs went into feature freeze > yesterday, so it'll have to wait until Emacs thaws again. > > Comment about the code: > >> + (concat >> + "Content-Disposition: form-data;name=" (car data) "\r\n\r\n" >> + (concat (mm-url-form-encode-xwfu (cdr data)) >> + ))) >> + )) > > This is not the Emacs parenthesis style. All the closing parentheses > should be on the same line. And there's a superfluous `concat' there... From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 25 03:32:18 2013 Received: (at 16198) by debbugs.gnu.org; 25 Dec 2013 08:32:18 +0000 Received: from localhost ([127.0.0.1]:40521 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vvjt4-0002wJ-6Y for submit@debbugs.gnu.org; Wed, 25 Dec 2013 03:32:18 -0500 Received: from hermes.netfonds.no ([80.91.224.195]:60685) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vvjt1-0002w9-Ny for 16198@debbugs.gnu.org; Wed, 25 Dec 2013 03:32:16 -0500 Received: from 46.67.128.193.tmi.telenormobil.no ([46.67.128.193] helo=building.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1Vvjsn-0002r2-QR; Wed, 25 Dec 2013 09:32:01 +0100 From: Lars Ingebrigtsen To: Kenjiro NAKAYAMA Subject: Re: bug#16198: 24.3.50; [PATCH 1/2] eww: Does not support file upload. References: <87fvpnzx8e.fsf@dhcp-193-97.nrt.redhat.com> <87ha9yzot3.fsf@building.gnus.org> <87ob457due.fsf@dhcp-193-97.nrt.redhat.com> Date: Wed, 25 Dec 2013 09:26:05 +0100 In-Reply-To: <87ob457due.fsf@dhcp-193-97.nrt.redhat.com> (Kenjiro NAKAYAMA's message of "Wed, 25 Dec 2013 13:29:29 +0900") Message-ID: <87r491l4ki.fsf@building.gnus.org> User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-MailScanner-ID: 1Vvjsn-0002r2-QR X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1388565122.21037@hjsrvKj9ifUZOAeov45hQA X-Spam-Status: No X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 16198 Cc: 16198@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Kenjiro NAKAYAMA writes: Looks good. One bit that could perhaps be changed is this: > + "Content-Disposition: form-data; name=\"" (cdr (assoc "name" (cdr data))) "\"; filename=\"" (cdr (assoc "filename" (cdr data))) "\"\r\n" Lines shouldn't be longer than 80 characters, and these file names may perhaps contain the " character, which would make these specs invalid? It's usually best to use `format' with %S in these cases: (setq file "foo\"bar") (insert (concat "name=\"" file "\"")) name="foo"bar" (insert (format "name=%S" file)) name="foo\"bar" -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/ From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 25 10:09:41 2013 Received: (at 16198) by debbugs.gnu.org; 25 Dec 2013 15:09:41 +0000 Received: from localhost ([127.0.0.1]:41466 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vvq5Z-00016p-5O for submit@debbugs.gnu.org; Wed, 25 Dec 2013 10:09:41 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:49944) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vvq5S-00016T-6G for 16198@debbugs.gnu.org; Wed, 25 Dec 2013 10:09:34 -0500 Received: by mail-pa0-f44.google.com with SMTP id fa1so7517135pad.3 for <16198@debbugs.gnu.org>; Wed, 25 Dec 2013 07:09:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version:content-type; bh=/G5s0rUJhtPOIzfd4ypbP14OchHCGPhCMsmFsT2UZ6o=; b=V2Ki06ynkOcXRLa3a1ZqpDxn9YyhMVOdLahqD0eGALhAtvjTqw0lukjKcGA5Lgcq8s uQrtw91DUb26S/elPCihMNQUWwUokqq+HIGo5xgiAvrVALW0hlxjchho6BA4A3xWnMPN AJ8C2pOi/8UmAH8YuS9RQddajL/30nk+0x0f/NAuGlgYPzLJYj8973JmCuXMLmZkhcbx NNoYJuPIBA627o+E7rMb7rrzv6FQilEjMZRUBRgaMyDjKJ/i0DzXR7H7wbzMSvwTqSvp gOd9NKl8WOm7RI+iegciEBL8LoZkJ6YzvD1f8qN0gc2ewc8XNUBGQ3di13ZmEugViIik 7s8w== X-Received: by 10.66.160.2 with SMTP id xg2mr38571069pab.23.1387984169020; Wed, 25 Dec 2013 07:09:29 -0800 (PST) Received: from dhcp-193-97.nrt.redhat.com (nat-pool-nrt-u1.redhat.com. [66.187.238.11]) by mx.google.com with ESMTPSA id ik1sm48981368pbc.9.2013.12.25.07.09.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Dec 2013 07:09:27 -0800 (PST) References: <87fvpnzx8e.fsf@dhcp-193-97.nrt.redhat.com> <87ha9yzot3.fsf@building.gnus.org> <87ob457due.fsf@dhcp-193-97.nrt.redhat.com> <87r491l4ki.fsf@building.gnus.org> User-agent: mu4e 0.9.9.6pre2; emacs 24.3.50.2 From: Kenjiro NAKAYAMA To: Lars Ingebrigtsen Subject: Re: bug#16198: 24.3.50; [PATCH 1/2] eww: Does not support file upload. In-reply-to: <87r491l4ki.fsf@building.gnus.org> Date: Thu, 26 Dec 2013 00:09:20 +0900 Message-ID: <874n5x7ysf.fsf@dhcp-193-97.nrt.redhat.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 16198 Cc: Kenjiro NAKAYAMA , 16198@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Thank you Lars, > Lines shouldn't be longer than 80 characters, and these file names may But If I include linefeed and indent in following line, the data has some "\t"s due to the indent. So I think one line is better. (format "Content-Disposition: form-data; name=%S; filename=%S\r\nContent-Type: text/plain; ....) -> With New Line and indent.(Many \t\t\t... are included in the data.) Content-Disposition: form-data; name="test"; filename="~/example.txt"\r\n\t\t\t\t\t\t\tContent-Type: text/plain; charset=utf-8\r\n\t\t\t\t\t\t\tContent-Transfer-Encoding: binary\r\n\r\n -> Non-breaking (The linefeed looks good) Content-Disposition: form-data; name="test"; filename="~/example.txt"\r\n Content-Type: text/plain; charset=utf-8\r\n Content-Transfer-Encoding: binary\r\n\r\n If I misunderstood your explanation, I am sorry. Since I made the patch again, I resend. The patch for the eww.el ([PATCH 2/2]) has no change. Signed-off-by: Kenjiro NAKAYAMA * gnus/mm-url.el (mm-url-encode-multipart-form-data): Restore to handle "maltipart/form-data" by eww. * net/eww.el(eww-form-file(defface)): New defface of file upload form. (eww-submit-file): New key map of file upload. (eww-form-file): New file upload button and file name context. (eww-select-file): Select file and display selected file name. (eww-tag-input): Handle input tag of file type. (eww-update-field): Add point offset. (eww-submit): Add submit with multipart/form-data. --- lisp/gnus/mm-url.el | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/lisp/gnus/mm-url.el b/lisp/gnus/mm-url.el index 6e83b18..4b5fedb 100644 --- a/lisp/gnus/mm-url.el +++ b/lisp/gnus/mm-url.el @@ -416,13 +416,51 @@ spaces. Die Die Die." (autoload 'mml-compute-boundary "mml") +(defun mm-url-encode-multipart-form-data (pairs &optional boundary) + "Return PAIRS encoded in multipart/form-data." + ;; RFC1867 + ;; Get a good boundary + (unless boundary + (setq boundary (mml-compute-boundary '()))) + (concat + ;; Start with the boundary + "--" boundary "\r\n" + ;; Create name value pairs + (mapconcat + 'identity + ;; Delete any returned items that are empty + (delq nil + (mapcar (lambda (data) + (cond ((equal (car data) "file") + ;; For each pair + (format + ;; Encode the name + "Content-Disposition: form-data; name=%S; filename=%S\r\nContent-Type: text/plain; charset=utf-8\r\nContent-Transfer-Encoding: binary\r\n\r\n%s" + (cdr (assoc "name" (cdr data))) (cdr (assoc "filename" (cdr data))) + (cond ((stringp (cdr (assoc "filedata" (cdr data)))) + (cdr (assoc "filedata" (cdr data)))) + ((integerp (cdr (assoc "filedata" (cdr data)))) + (number-to-string (cdr (assoc "filedata" (cdr data)))))))) + ((equal (car data) "submit") + "Content-Disposition: form-data; name=\"submit\"\r\n\r\nSubmit\r\n") + (t + (format + "Content-Disposition: form-data;name=%S\r\n\r\n%s\r\n" + (car data) (concat (mm-url-form-encode-xwfu (cdr data))) + )))) + pairs)) + ;; use the boundary as a separator + (concat "\r\n--" boundary "\r\n")) + ;; put a boundary at the end. + "--" boundary "--\r\n")) + (defun mm-url-remove-markup () "Remove all HTML markup, leaving just plain text." (goto-char (point-min)) (while (search-forward "" nil t) - (point-max)))) + (or (search-forward "-->" nil t) + (point-max)))) (goto-char (point-min)) (while (re-search-forward "<[^>]+>" nil t) (replace-match "" t t))) -- 1.8.3.1 Regards, Kenjiro larsi@gnus.org writes: > Kenjiro NAKAYAMA writes: > > Looks good. One bit that could perhaps be changed is this: > >> + "Content-Disposition: form-data; name=\"" (cdr (assoc "name" (cdr data))) "\"; filename=\"" (cdr (assoc "filename" (cdr data))) "\"\r\n" > > Lines shouldn't be longer than 80 characters, and these file names may > perhaps contain the " character, which would make these specs invalid? > > It's usually best to use `format' with %S in these cases: > > (setq file "foo\"bar") > > (insert (concat "name=\"" file "\"")) > name="foo"bar" > > (insert (format "name=%S" file)) > name="foo\"bar" From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 10 16:34:57 2014 Received: (at 16198) by debbugs.gnu.org; 10 Nov 2014 21:34:57 +0000 Received: from localhost ([127.0.0.1]:56392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xnwbw-00040S-HF for submit@debbugs.gnu.org; Mon, 10 Nov 2014 16:34:57 -0500 Received: from hermes.netfonds.no ([80.91.224.195]:40166) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xnwbv-00040K-4Z for 16198@debbugs.gnu.org; Mon, 10 Nov 2014 16:34:55 -0500 Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=stories.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1Xnwbc-0001kf-OU; Mon, 10 Nov 2014 22:34:36 +0100 From: Lars Magne Ingebrigtsen To: Kenjiro NAKAYAMA Subject: Re: bug#16198: 24.3.50; [PATCH 1/2] eww: Does not support file upload. References: <87fvpnzx8e.fsf@dhcp-193-97.nrt.redhat.com> <87ha9yzot3.fsf@building.gnus.org> <87ob457due.fsf@dhcp-193-97.nrt.redhat.com> <87r491l4ki.fsf@building.gnus.org> <874n5x7ysf.fsf@dhcp-193-97.nrt.redhat.com> X-Now-Playing: The Cure's _Kiss Me, Kiss Me, Kiss Me_ X-Hashcash: 1:23:141110:nakayamakenjiro@gmail.com::HXf819FeDIyP8IEM:000000000000000000000000000000000000CJ0L X-Hashcash: 1:23:141110:16198@debbugs.gnu.org::fRcXY+I9ZaI9HNo5:0000000000000000000000000000000000000000YYbr Date: Mon, 10 Nov 2014 22:34:36 +0100 In-Reply-To: <874n5x7ysf.fsf@dhcp-193-97.nrt.redhat.com> (Kenjiro NAKAYAMA's message of "Thu, 26 Dec 2013 00:09:20 +0900") Message-ID: User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-MailScanner-ID: 1Xnwbc-0001kf-OU X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1416260077.32403@O/5udaHgl8ZPgdEQDkZk3Q X-Spam-Status: No X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 16198 Cc: 16198@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Kenjiro NAKAYAMA writes: > Since I made the patch again, I resend. > The patch for the eww.el ([PATCH 2/2]) has no change. Thanks; applied. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 10 16:34:59 2014 Received: (at control) by debbugs.gnu.org; 10 Nov 2014 21:35:00 +0000 Received: from localhost ([127.0.0.1]:56396 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xnwbz-00040k-AV for submit@debbugs.gnu.org; Mon, 10 Nov 2014 16:34:59 -0500 Received: from hermes.netfonds.no ([80.91.224.195]:40685) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xnwbx-00040T-7j for control@debbugs.gnu.org; Mon, 10 Nov 2014 16:34:57 -0500 Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=stories.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1Xnwbf-0001km-I4 for control@debbugs.gnu.org; Mon, 10 Nov 2014 22:34:39 +0100 Date: Mon, 10 Nov 2014 22:34:39 +0100 Message-Id: To: control@debbugs.gnu.org From: Lars Magne Ingebrigtsen Subject: control message for bug #16198 X-MailScanner-ID: 1Xnwbf-0001km-I4 X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1416260079.98418@fCEETwhtswwgfwDdQiNovw X-Spam-Status: No X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) tags 16198 fixed close 16198 25.1 From unknown Fri Aug 15 12:50:54 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 09 Dec 2014 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator