[gnus git] branch master updated: m0-11-77-g7e786d9 =1= Allow uploading files from eww
Katsumi <[email protected]> Tue, 11 Nov 2014 00:24:07 +0100
| Newsgroups | gmane.emacs.gnus.cvs |
|---|---|
| Message-ID | <[email protected]> |
via 7e786d916eab790801d610b2a502fc2585f673f1 (commit)
from 7dc6931f0d00f624db4ec29ea5e94c2e32ff28a3 (commit)
- Log -----------------------------------------------------------------
commit 7e786d916eab790801d610b2a502fc2585f673f1
Author: Kenjiro NAKAYAMA <[email protected]>
Date: Mon Nov 10 23:23:34 2014 +0000
Allow uploading files from eww
2014-11-10 Kenjiro NAKAYAMA <[email protected]>
* mm-url.el (mm-url-encode-multipart-form-data):
Restore to handle "multipart/form-data" by eww.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b434965..4bae4ad 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-10 Kenjiro NAKAYAMA <[email protected]>
+
+ * mm-url.el (mm-url-encode-multipart-form-data):
+ Restore to handle "multipart/form-data" by eww.
+
2014-11-07 Tassilo Horn <[email protected]>
* gnus-start.el (gnus-activate-group): Fix typo reported by Tim
diff --git a/lisp/mm-url.el b/lisp/mm-url.el
index bb342d6..bbeb1d8 100644
--- a/lisp/mm-url.el
+++ b/lisp/mm-url.el
@@ -414,6 +414,44 @@ 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))
-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.
Summary of changes:
lisp/ChangeLog | 5 +++++
lisp/mm-url.el | 42 ++++++++++++++++++++++++++++++++++++++++--
2 files changed, 45 insertions(+), 2 deletions(-)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".
The branch, master has been updated
hooks/post-receive
--
Gnus Project