From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shiyuan Subject: xml-rpc-request error for wordpress Date: Sat, 17 Jan 2015 16:23:35 -0800 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org To: "emacs-orgmode@gnu.org" , help-gnu-emacs List-Id: emacs-orgmode.gnu.org Hi all, I have been using org2blog/wp package to manage my wordpress blog. It had been woking very well until last week when things started to fail. org2blog/wp uses xml-rpc-request to connect to wordpress.com which returns the 301 Error. I haven't changed my emacs config for quite a long time. So I guess something might have happened on the wordpress side or some emacs packages break something. I have googled around but cannot find any relevant info. I don't have too much experience about xml-rpc. Any help about debugging this issue would be appreciated. The traceback is attached. I can login wordpress and maintain my blog through the browser and web interface. Thanks. ------------------------------------ signal(error ("Error during request: 301")) error("Error during request: %s" 301) (progn (error "Error during request: %s" url-http-response-status)) (if (> url-http-response-status 299) (progn (error "Error during request: %s" url-http-response-status))) (save-current-buffer (set-buffer buffer) (if (not (numberp url-http-response-status)) (progn (error "Why? url-http-response-status is %s" url-http-response-status))) (if (> url-http-response-status 299) (progn (error "Error during request: %s" url-http-response-status)))) (let ((buffer (url-retrieve-synchronously server-url))) (save-current-buffer (set-buffer buffer) (if (not (numberp url-http-response-status)) (progn (error "Why? url-http-response-status is %s" url-http-response-status))) (if (> url-http-response-status 299) (progn (error "Error during request: %s" url-http-response-status)))) (xml-rpc-request-process-buffer buffer)) (if async-callback-function (url-retrieve server-url async-callback-function) (let ((buffer (url-retrieve-synchronously server-url))) (save-current-buffer (set-buffer buffer) (if (not (numberp url-http-response-status)) (progn (error "Why? url-http-response-status is %s" url-http-response-status))) (if (> url-http-response-status 299) (progn (error "Error during request: %s" url-http-response-status)))) (xml-rpc-request-process-buffer buffer))) (cond ((boundp (quote url-be-asynchronous)) (if async-callback-function (setq url-be-asynchronous t url-current-callback-data (list async-callback-function (current-buffer)) url-current-callback-func (quote xml-rpc-request-callback-handler)) (setq url-be-asynchronous nil)) (url-retrieve server-url t) (if (not url-be-asynchronous) (progn (let ((result (xml-rpc-request-process-buffer ...))) (if (> xml-rpc-debug 1) (progn (print result ...))) result)))) (t (if async-callback-function (url-retrieve server-url async-callback-function) (let ((buffer (url-retrieve-synchronously server-url))) (save-current-buffer (set-buffer buffer) (if (not (numberp url-http-response-status)) (progn (error "Why? url-http-response-status is %s" url-http-response-status))) (if (> url-http-response-status 299) (progn (error "Error during request: %s" url-http-response-status)))) (xml-rpc-request-process-buffer buffer))))) (let ((url-request-method "POST") (url-package-name "xml-rpc.el") (url-package-version xml-rpc-version) (url-request-data (concat "\n" (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ... ... ...) (and ... ...)))) "\n")) (url-mime-charset-string "utf-8;q=1, iso-8859-1;q=0.5") (url-request-coding-system xml-rpc-use-coding-system) (url-http-attempt-keepalives nil) (url-request-extra-headers (list (cons "Connection" "close") (cons "Content-Type" "text/xml; charset=utf-8")))) (if (> xml-rpc-debug 1) (progn (print url-request-data (create-file-buffer "request-data")))) (cond ((boundp (quote url-be-asynchronous)) (if async-callback-function (setq url-be-asynchronous t url-current-callback-data (list async-callback-function (current-buffer)) url-current-callback-func (quote xml-rpc-request-callback-handler)) (setq url-be-asynchronous nil)) (url-retrieve server-url t) (if (not url-be-asynchronous) (progn (let ((result ...)) (if (> xml-rpc-debug 1) (progn ...)) result)))) (t (if async-callback-function (url-retrieve server-url async-callback-function) (let ((buffer (url-retrieve-synchronously server-url))) (save-current-buffer (set-buffer buffer) (if (not ...) (progn ...)) (if (> url-http-response-status 299) (progn ...))) (xml-rpc-request-process-buffer buffer)))))) (save-excursion (let ((url-request-method "POST") (url-package-name "xml-rpc.el") (url-package-version xml-rpc-version) (url-request-data (concat "\n" (let ((temp-buffer ...)) (save-current-buffer (set-buffer temp-buffer) (unwind-protect ... ...))) "\n")) (url-mime-charset-string "utf-8;q=1, iso-8859-1;q=0.5") (url-request-coding-system xml-rpc-use-coding-system) (url-http-attempt-keepalives nil) (url-request-extra-headers (list (cons "Connection" "close") (cons "Content-Type" "text/xml; charset=utf-8")))) (if (> xml-rpc-debug 1) (progn (print url-request-data (create-file-buffer "request-data")))) (cond ((boundp (quote url-be-asynchronous)) (if async-callback-function (setq url-be-asynchronous t url-current-callback-data (list async-callback-function (current-buffer)) url-current-callback-func (quote xml-rpc-request-callback-handler)) (setq url-be-asynchronous nil)) (url-retrieve server-url t) (if (not url-be-asynchronous) (progn (let (...) (if ... ...) result)))) (t (if async-callback-function (url-retrieve server-url async-callback-function) (let ((buffer ...)) (save-current-buffer (set-buffer buffer) (if ... ...) (if ... ...)) (xml-rpc-request-process-buffer buffer))))))) (unwind-protect (save-excursion (let ((url-request-method "POST") (url-package-name "xml-rpc.el") (url-package-version xml-rpc-version) (url-request-data (concat "\n" (let (...) (save-current-buffer ... ...)) "\n")) (url-mime-charset-string "utf-8;q=1, iso-8859-1;q=0.5") (url-request-coding-system xml-rpc-use-coding-system) (url-http-attempt-keepalives nil) (url-request-extra-headers (list (cons "Connection" "close") (cons "Content-Type" "text/xml; charset=utf-8")))) (if (> xml-rpc-debug 1) (progn (print url-request-data (create-file-buffer "request-data")))) (cond ((boundp (quote url-be-asynchronous)) (if async-callback-function (setq url-be-asynchronous t url-current-callback-data (list async-callback-function ...) url-current-callback-func (quote xml-rpc-request-callback-handler)) (setq url-be-asynchronous nil)) (url-retrieve server-url t) (if (not url-be-asynchronous) (progn (let ... ... result)))) (t (if async-callback-function (url-retrieve server-url async-callback-function) (let (...) (save-current-buffer ... ... ...) (xml-rpc-request-process-buffer buffer)))))))) xml-rpc-request("http://myname.wordpress.com/xmlrpc.php" ((methodCall nil (methodName nil "metaWeblog.getCategories") (params nil (param nil (value nil (string nil "1"))) (param nil (value nil (string nil "myname"))) (param nil (value nil (string nil "######")))))) nil) (let* ((m-name (if (stringp method) method (symbol-name method))) (m-params (mapcar (function (lambda (p) (list (quote param) nil (car ...)))) (if async-callback-func params (car-safe params)))) (m-func-call (list (list (quote methodCall) nil (list (quote methodName) nil m-name) (append (quote (params nil)) m-params))))) (if (> xml-rpc-debug 1) (progn (print m-func-call (create-file-buffer "func-call")))) (xml-rpc-request server-url m-func-call async-callback-func)) xml-rpc-method-call-async(nil "http://myname.wordpress.com/xmlrpc.php" "metaWeblog.getCategories" ("1" "myname" "######")) (let ((response (xml-rpc-method-call-async nil server-url method params))) (cond ((stringp response) (list (cons nil (concat "URL/HTTP Error: " response)))) (t (xml-rpc-xml-to-response response)))) xml-rpc-method-call("http://myname.wordpress.com/xmlrpc.php" "metaWeblog.getCategories" "1" "myname" "######") metaweblog-get-categories("http://myname.wordpress.com/xmlrpc.php" "myname" "######" "1") (mapcar (function (lambda (category) (cdr (assoc "categoryName" category)))) (metaweblog-get-categories org2blog/wp-server-xmlrpc-url org2blog/wp-server-userid org2blog/wp-server-pass org2blog/wp-server-blogid)) (setq org2blog/wp-blog (assoc org2blog/wp-blog-name org2blog/wp-blog-alist) org2blog/wp-server-xmlrpc-url (plist-get (cdr org2blog/wp-blog) :url) org2blog/wp-server-userid (eval (plist-get (cdr org2blog/wp-blog) :username)) org2blog/wp-server-blogid (or (plist-get (cdr org2blog/wp-blog) :id) "1") org2blog/wp-server-pass (or (eval (plist-get (cdr org2blog/wp-blog) :password)) (read-passwd (format "%s Weblog password? " org2blog/wp-blog-name))) org2blog/wp-categories-list (mapcar (function (lambda (category) (cdr (assoc "categoryName" category)))) (metaweblog-get-categories org2blog/wp-server-xmlrpc-url org2blog/wp-server-userid org2blog/wp-server-pass org2blog/wp-server-blogid)) org2blog/wp-tags-list (mapcar (function (lambda (tag) (cdr (assoc "slug" tag)))) (wp-get-tags org2blog/wp-server-xmlrpc-url org2blog/wp-server-userid org2blog/wp-server-pass org2blog/wp-server-blogid)) org2blog/wp-pages-list (mapcar (function (lambda (pg) (cons (cdr (assoc "page_title" pg)) (cdr (assoc "page_id" pg))))) (wp-get-pagelist org2blog/wp-server-xmlrpc-url org2blog/wp-server-userid org2blog/wp-server-pass org2blog/wp-server-blogid))) (let nil (setq org2blog/wp-blog-name (or blog-name (and (equal (length org2blog/wp-blog-alist) 1) (car (car org2blog/wp-blog-alist))) (completing-read "Blog to login into? ([Tab] to see list): " (mapcar (quote car) org2blog/wp-blog-alist) nil t))) (if (> (length org2blog/wp-blog-name) 1) nil (error "Invalid blog name")) (setq org2blog/wp-blog (assoc org2blog/wp-blog-name org2blog/wp-blog-alist) org2blog/wp-server-xmlrpc-url (plist-get (cdr org2blog/wp-blog) :url) org2blog/wp-server-userid (eval (plist-get (cdr org2blog/wp-blog) :username)) org2blog/wp-server-blogid (or (plist-get (cdr org2blog/wp-blog) :id) "1") org2blog/wp-server-pass (or (eval (plist-get (cdr org2blog/wp-blog) :password)) (read-passwd (format "%s Weblog password? " org2blog/wp-blog-name))) org2blog/wp-categories-list (mapcar (function (lambda (category) (cdr (assoc "categoryName" category)))) (metaweblog-get-categories org2blog/wp-server-xmlrpc-url org2blog/wp-server-userid org2blog/wp-server-pass org2blog/wp-server-blogid)) org2blog/wp-tags-list (mapcar (function (lambda (tag) (cdr (assoc "slug" tag)))) (wp-get-tags org2blog/wp-server-xmlrpc-url org2blog/wp-server-userid org2blog/wp-server-pass org2blog/wp-server-blogid)) org2blog/wp-pages-list (mapcar (function (lambda (pg) (cons (cdr (assoc "page_title" pg)) (cdr (assoc "page_id" pg))))) (wp-get-pagelist org2blog/wp-server-xmlrpc-url org2blog/wp-server-userid org2blog/wp-server-pass org2blog/wp-server-blogid))) (setq org2blog/wp-logged-in t) (message "Logged in")) org2blog/wp-login("wordpress") (if org2blog/wp-logged-in nil (org2blog/wp-login blog-name)) (let ((blog-name (org2blog/wp-get-blog-name))) (if (and blog-name (not (equal blog-name org2blog/wp-blog-name))) (progn (org2blog/wp-logout))) (if org2blog/wp-logged-in nil (org2blog/wp-login blog-name))) org2blog/wp-correctly-login() org2blog/wp-post-buffer(t) org2blog/wp-post-buffer-and-publish() call-interactively(org2blog/wp-post-buffer-and-publish record nil) command-execute(org2blog/wp-post-buffer-and-publish record) execute-extended-command(nil "org2blog/wp-post-buffer-and-publish") call-interactively(execute-extended-command nil nil)