X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fmm-url.el;h=bb342d6b8b120324a44deae5d8c3d09890b3a67d;hb=1ac3dd7fdc85553c5cf7eec4077470e02430da68;hp=2ce3791ef3da66f96fd936f4cbbaab9d4ac34dcb;hpb=d2c69c9ecc6b40ecfa98a53b9165bef1ad513400;p=gnus diff --git a/lisp/mm-url.el b/lisp/mm-url.el index 2ce3791ef..bb342d6b8 100644 --- a/lisp/mm-url.el +++ b/lisp/mm-url.el @@ -1,6 +1,6 @@ ;;; mm-url.el --- a wrapper of url functions/commands for Gnus -;; Copyright (C) 2001-2011 Free Software Foundation, Inc. +;; Copyright (C) 2001-2014 Free Software Foundation, Inc. ;; Author: Shenghuo Zhu @@ -21,7 +21,7 @@ ;;; Commentary: -;; Some codes are stolen from w3 and url packages. Some are moved from +;; Some code is stolen from w3 and url packages. Some are moved from ;; nnweb. ;; TODO: Support POST, cookie. @@ -264,8 +264,6 @@ This is taken from RFC 2396.") (require 'url-parse) (require 'url-vars)) (error nil)) - ;; w3-4.0pre0.46 or earlier version. - (require 'w3-vars) (require 'url))) ;;;###autoload @@ -416,69 +414,6 @@ 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) - (when (car data) - ;; For each pair - (concat - - ;; Encode the name - "Content-Disposition: form-data; name=\"" - (car data) "\"\r\n" - "Content-Type: text/plain; charset=utf-8\r\n" - "Content-Transfer-Encoding: binary\r\n\r\n" - - (cond ((stringp (cdr data)) - (cdr data)) - ((integerp (cdr data)) - (int-to-string (cdr data)))) - - "\r\n"))) - pairs)) - ;; use the boundary as a separator - (concat "--" boundary "\r\n")) - - ;; put a boundary at the end. - "--" boundary "--\r\n")) - -(defun mm-url-fetch-form (url pairs) - "Fetch a form from URL with PAIRS as the data using the POST method." - (mm-url-load-url) - (let ((url-request-data (mm-url-encode-www-form-urlencoded pairs)) - (url-request-method "POST") - (url-request-extra-headers - '(("Content-type" . "application/x-www-form-urlencoded")))) - (url-insert-file-contents url) - (setq buffer-file-name nil)) - t) - -(defun mm-url-fetch-simple (url content) - (mm-url-load-url) - (let ((url-request-data content) - (url-request-method "POST") - (url-request-extra-headers - '(("Content-type" . "application/x-www-form-urlencoded")))) - (url-insert-file-contents url) - (setq buffer-file-name nil)) - t) - (defun mm-url-remove-markup () "Remove all HTML markup, leaving just plain text." (goto-char (point-min))