Skip to content

Commit

Permalink
Accept HTTP responses generated by old versions of curl.
Browse files Browse the repository at this point in the history
* twittering-mode.el: Accept HTTP responses generated by old
versions of curl. The regular expressions of HTTP responses are
updated so that they match headers starting with "HTTP/2.0".
(twittering-make-header-info-alist): update the regexp.
(twittering-pre-process-buffer-curl): likewise.
(twittering-oauth-get-response-alist): likewise.
  • Loading branch information
cvmat committed Jul 3, 2016
1 parent 0dc2ba1 commit 4dc7b75
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Expand Up @@ -13,6 +13,13 @@
(twittering-pre-process-buffer-curl): likewise.
(twittering-oauth-get-response-alist): likewise.

* twittering-mode.el: Accept HTTP responses generated by old
versions of curl. The regular expressions of HTTP responses are
updated so that they match headers starting with "HTTP/2.0".
(twittering-make-header-info-alist): update the regexp.
(twittering-pre-process-buffer-curl): likewise.
(twittering-oauth-get-response-alist): likewise.

2016-06-17 Tadashi MATSUO <tad@mymail.twin.jp>

* twittering-mode.el: You can retweet your own tweets.
Expand Down
8 changes: 4 additions & 4 deletions twittering-mode.el
Expand Up @@ -2060,7 +2060,7 @@ The alist consists of pairs of field-name and field-value, such as
(status-line (car lines))
(header-lines (cdr lines)))
(when (string-match
"^\\(HTTP/1\\.[01]\\|HTTP/2\\) \\([0-9][0-9][0-9]\\)\\(.*\\)$"
"^\\(HTTP/1\\.[01]\\|HTTP/2\\(?:\\.0\\)?\\) \\([0-9][0-9][0-9]\\)\\(.*\\)$"
status-line)
(append `((status-line . ,status-line)
(http-version . ,(match-string 1 status-line))
Expand Down Expand Up @@ -2560,10 +2560,10 @@ The method to perform the request is determined from
(goto-char (point-min))
(let ((first-regexp
;; successful HTTP response
"\\`HTTP/\\(1\\.[01]\\|2\\) 2[0-9][0-9].*?\r?\n")
"\\`HTTP/\\(1\\.[01]\\|2\\(\\.0\\)?\\) 2[0-9][0-9].*?\r?\n")
(next-regexp
;; following HTTP response
"^\\(\r?\n\\)HTTP/\\(1\\.[01]\\|2\\) [0-9][0-9][0-9].*?\r?\n"))
"^\\(\r?\n\\)HTTP/\\(1\\.[01]\\|2\\(\\.0\\)?\\) [0-9][0-9][0-9].*?\r?\n"))
(when (and (search-forward-regexp first-regexp nil t)
(search-forward-regexp next-regexp nil t))
(let ((beg (point-min))
Expand Down Expand Up @@ -3610,7 +3610,7 @@ function."
(with-current-buffer buffer
(goto-char (point-min))
(when (search-forward-regexp
"\\`\\(\\(HTTP/1\\.[01]\\|HTTP/2\\) \\([0-9][0-9][0-9]\\)\\(.*?\\)\\)\r?\n"
"\\`\\(\\(HTTP/1\\.[01]\\|HTTP/2\\(?:\\.0\\)?\\) \\([0-9][0-9][0-9]\\)\\(.*?\\)\\)\r?\n"
nil t)
(let ((status-line (match-string 1))
(http-version (match-string 2))
Expand Down

0 comments on commit 4dc7b75

Please sign in to comment.