summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2016-10-14 01:35:15 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2016-10-14 01:35:15 +0200
commit1a99d5dda2460946b1035827bd2407b5f0d8336c (patch)
treeb2d7f5b58e430cab7461343c8d0ce1fab155c058
parenta6e0188dffc394698d9ffbef50401f14a31c8722 (diff)
downloademacs-1a99d5dda2460946b1035827bd2407b5f0d8336c.tar.gz
Cosmetic change to last mm-url change
* lisp/gnus/mm-url.el (mm-url-encode-multipart-form-data): Tweak last change slightly for more readability.
-rw-r--r--lisp/gnus/mm-url.el62
1 files changed, 32 insertions, 30 deletions
diff --git a/lisp/gnus/mm-url.el b/lisp/gnus/mm-url.el
index d5debdb3704..76c37722995 100644
--- a/lisp/gnus/mm-url.el
+++ b/lisp/gnus/mm-url.el
@@ -411,41 +411,43 @@ DATA is a list where the elements can have the following form:
(\"filename\" . \"FILENAME\")
(\"content-type\" . \"CONTENT-TYPE\")
(\"filedata\" . \"FILEDATA\")))
-Lowercase names above are literals and uppercase can
-be various values."
+Lowercase strings above are literals and uppercase are not."
;; RFC1867
- ;; Get a good boundary
+ ;; Get a good boundary.
(unless boundary
(setq boundary (mml-compute-boundary '())))
(with-temp-buffer
(set-buffer-multibyte nil)
- (cl-loop for (name . value) in data
- do (insert "--" boundary "\r\n")
- (cond
- ((equal name "file")
- (insert (format "Content-Disposition: form-data; name=%S; filename=%S\r\n"
- (or (cdr (assoc "name" value)) name)
- (cdr (assoc "filename" value))))
- (insert "Content-Transfer-Encoding: binary\r\n")
- (insert (format "Content-Type: %s\r\n\r\n"
- (or (cdr (assoc "content-type" value))
- "text/plain")))
- (let ((filedata (cdr (assoc "filedata" value))))
- (cond
- ((stringp filedata)
- (insert filedata))
- ;; How can this possibly be useful?
- ((integerp filedata)
- (insert (number-to-string filedata))))))
- ((equal name "submit")
- (insert
- "Content-Disposition: form-data; name=\"submit\"\r\n\r\nSubmit\r\n"))
- (t
- (insert (format "Content-Disposition: form-data; name=%S\r\n\r\n"
- name))
- (insert value)))
- (unless (bolp)
- (insert "\r\n")))
+ (dolist (elem data)
+ (let ((name (car elem))
+ (value (cdr elem)))
+ (insert "--" boundary "\r\n")
+ (cond
+ ((equal name "file")
+ (insert (format
+ "Content-Disposition: form-data; name=%S; filename=%S\r\n"
+ (or (cdr (assoc "name" value)) name)
+ (cdr (assoc "filename" value))))
+ (insert "Content-Transfer-Encoding: binary\r\n")
+ (insert (format "Content-Type: %s\r\n\r\n"
+ (or (cdr (assoc "content-type" value))
+ "text/plain")))
+ (let ((filedata (cdr (assoc "filedata" value))))
+ (cond
+ ((stringp filedata)
+ (insert filedata))
+ ;; How can this possibly be useful?
+ ((integerp filedata)
+ (insert (number-to-string filedata))))))
+ ((equal name "submit")
+ (insert
+ "Content-Disposition: form-data; name=\"submit\"\r\n\r\nSubmit\r\n"))
+ (t
+ (insert (format "Content-Disposition: form-data; name=%S\r\n\r\n"
+ name))
+ (insert value)))
+ (unless (bolp)
+ (insert "\r\n"))))
(insert "--" boundary "--\r\n")
(buffer-string)))