diff --git a/ChangeLog b/ChangeLog index c05002d9..dd5439c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,16 @@ <<<<<<< HEAD:ChangeLog +<<<<<<< HEAD:ChangeLog +======= +2009-12-30 Tadashi MATSUO + + * twittering-mode.el (twittering-get-response-header): On failure, + the function returns an empty string instead of the whole contents + of the buffer. + (twittering-get-response-body): When the function fails to find + the tail of header, it returns nil without trying to parse a + region. + +>>>>>>> 'twittering-get-response-...()' return "" or nil on failure.:ChangeLog 2009-12-30 Satoshi Yatagawa * twittering-mode.el (twittering-get-response-header): Correct a diff --git a/twittering-mode.el b/twittering-mode.el index 5cfad966..9c3da6c2 100644 --- a/twittering-mode.el +++ b/twittering-mode.el @@ -1136,11 +1136,9 @@ PARAMETERS is alist of URI parameters. (when (search-forward-regexp "HTTP/1\\.[01] 200 Connection established\r\n\r\n" nil t) (delete-region (point-min) (point))) - (let* ((start (point)) - (end (if (search-forward-regexp "\r?\n\r?\n" nil t) - (match-end 0) - (point-max)))) - (buffer-substring start end)))) + (if (search-forward-regexp "\r?\n\r?\n" nil t) + (buffer-substring (point-min) (match-end 0)) + ""))) (defun twittering-get-response-body (buffer) "Exract HTTP response body from HTTP response, parse it as XML, and return a @@ -1150,13 +1148,13 @@ XML tree as list. Return nil when parse failed. (save-excursion (set-buffer buffer) (goto-char (point-min)) - (let ((start (if (search-forward-regexp "\r?\n\r?\n" nil t) - (match-end 0) - (point)))) - (condition-case get-error ;; to guard when `xml-parse-region' failed. - (xml-parse-region start (point-max)) - (error (message "Failure: %s" get-error) - nil))) + (if (search-forward-regexp "\r?\n\r?\n" nil t) + (let ((start (match-end 0))) + (condition-case get-error ;; to guard when `xml-parse-region' failed. + (xml-parse-region start (point-max)) + (error (message "Failure: %s" get-error) + nil))) + nil) )) (defun twittering-cache-status-datum (status-datum &optional data-var)