From 8a89abe67e88c703de1904a17e99db641651eb56 Mon Sep 17 00:00:00 2001 From: bg66 Date: Fri, 1 Dec 2006 02:12:05 +0000 Subject: [PATCH] * mixi.el (mixi-topic-comment-list-page): Use `%d' instead of `all'. (mixi-event-comment-list-page): Ditto. (mixi-url-retrieve): Fix for `HTTP/1.0 500 Internal Server Error' of BBS page. (mixi-w3m-retrieve): Ditto. (mixi-curl-retrieve): Ditto. --- ChangeLog | 9 +++++++++ mixi.el | 30 ++++++++++++++++-------------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2fe21ba..95523fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2006-12-01 OHASHI Akira + * mixi.el (mixi-topic-comment-list-page): Use `%d' instead of `all'. + (mixi-event-comment-list-page): Ditto. + (mixi-url-retrieve): Fix for `HTTP/1.0 500 Internal Server Error' of + BBS page. + (mixi-w3m-retrieve): Ditto. + (mixi-curl-retrieve): Ditto. + +2006-12-01 OHASHI Akira + * mixi.el (mixi-parse-buffer): Rename from `mixi-retrieve-1', and swap `buffer' argument and `url'. (mixi-url-retrieve): Follow the change above. diff --git a/mixi.el b/mixi.el index 5715b15..c46688d 100644 --- a/mixi.el +++ b/mixi.el @@ -254,17 +254,17 @@ Increase this value when unexpected error frequently occurs." (error (mixi-message "Cannot retrieve"))) (with-current-buffer buffer (goto-char (point-min)) - (if (re-search-forward "HTTP/[0-9.]+ 302 Moved" nil t) + (if (re-search-forward "HTTP/[0-9]+\\.[0-9]+ 302" nil t) (if (re-search-forward (concat "Location: " mixi-url "\\(.+\\)") nil t) (setq ret (mixi-url-retrieve (match-string 1) post-data)) (setq ret (mixi-url-retrieve "/home.pl" post-data))) - (unless (re-search-forward "HTTP/[0-9.]+ 200 OK" nil t) + ;; Allow `500' because BBS page might return + ;; `HTTP/1.0 500 Internal Server Error'. + (unless (looking-at "HTTP/[0-9]+\\.[0-9]+ [25]00") (error (mixi-message "Cannot retrieve"))) - (search-forward "\n\n") - (setq ret (decode-coding-string - (buffer-substring-no-properties (point) (point-max)) - mixi-coding-system)) + (delete-region (point) (re-search-forward "\r?\n\r?\n")) + (setq ret (decode-coding-string (buffer-string) mixi-coding-system)) (kill-buffer buffer) (setq ret (mixi-parse-buffer url ret post-data)))) ret)) @@ -273,11 +273,11 @@ Increase this value when unexpected error frequently occurs." "Retrieve the URL and return gotten strings." (let ((url (mixi-expand-url url))) (with-temp-buffer - (if (not (string= (w3m-retrieve url nil nil post-data) "text/html")) - (error (mixi-message "Cannot retrieve")) - (w3m-decode-buffer url) - (let ((ret (buffer-substring-no-properties (point-min) (point-max)))) - (mixi-parse-buffer url ret post-data)))))) + ;; Don't check return code of `w3m-retrieve' because BBS page might + ;; return `HTTP/1.0 500 Internal Server Error'. + (w3m-retrieve url nil nil post-data) + (w3m-decode-buffer url) + (mixi-parse-buffer url (buffer-string) post-data)))) (defun mixi-curl-retrieve (url &optional post-data) "Retrieve the URL and return gotten strings." @@ -309,7 +309,9 @@ Increase this value when unexpected error frequently occurs." (goto-char (point-min)) (while (looking-at "HTTP/[0-9]+\\.[0-9]+ [13][0-9][0-9]") (delete-region (point) (re-search-forward "\r?\n\r?\n"))) - (unless (looking-at "HTTP/[0-9]+\\.[0-9]+ 200") + ;; Allow `500' because BBS page might return + ;; `HTTP/1.0 500 Internal Server Error'. + (unless (looking-at "HTTP/[0-9]+\\.[0-9]+ [25]00") (error (mixi-message "Cannot retrieve"))) (delete-region (point) (re-search-forward "\r?\n\r?\n")) (setq ret (decode-coding-string (buffer-string) mixi-coding-system)) @@ -1767,7 +1769,7 @@ Increase this value when unexpected error frequently occurs." ") (defun mixi-topic-comment-list-page (topic) - (concat "/view_bbs.pl?page=all" + (concat "/view_bbs.pl?page=%d" "&id=" (mixi-topic-id topic) "&comm_id=" (mixi-community-id (mixi-topic-community topic)))) @@ -1802,7 +1804,7 @@ Increase this value when unexpected error frequently occurs." ") (defun mixi-event-comment-list-page (event) - (concat "/view_event.pl?page=all" + (concat "/view_event.pl?page=%d" "&id=" (mixi-event-id event) "&comm_id=" (mixi-community-id (mixi-event-community event)))) -- 1.7.10.4