search failed: ^M #1

Closed
AHands opened this Issue Jan 20, 2011 · 2 comments

Comments

Projects
None yet
4 participants
@AHands

AHands commented Jan 20, 2011

patch offered to:

  • fix buffer-search to not kill the script when authorization fails

  • meaningful error msg on bad server response

  • configurable path for curl

    --- /cygdrive/c/psanford-emacs-oauth-e6b93d1/oauth.el 2011-01-18 00:09:18.000000000 -0500
    +++ /cygdrive/c/cygwin/home/x/.emacs.d/site-lisp/oauth.el 2011-01-20 06:15:35.214843700 -0500
    @@ -136,6 +136,11 @@

    It is generally recomended that you use curl for your requests.")

    +(defvar oauth-path-curl "curl"

    • "Specifies the path to the curl executable.
    • (set 'oauth-path-curl "C:\curl-7.21.3-ssl-sspi-zlib-static-bin-w32\curl.exe")
      +")

    (defvar oauth-curl-insecure t
    "Use the curl insecure flag (-k) which ignores ssl certificate errors.")

    @@ -317,10 +322,18 @@
    (set-buffer (oauth-do-request req))
    (goto-char (point-min))
    (let ((linebreak (search-forward "\n\n" nil t nil)))

    •  (when linebreak
      
    •    (delete-region (point-min) linebreak)))
      
    •  (if linebreak
      
    • (delete-region (point-min) linebreak)
      
    • (error "cannot find expected blank line %-80s" (buffer-string) )
    • )
    •  )
      
      (goto-char (point-max))
    • (delete-region (point-min) (+ (search-backward "\r\n") 2))
    • (let ((lastline (search-backward "\r\n" nil t nil)))
    •  (if lastline
      
    • (delete-region (point-min) (+ lastline 2))
      
    • (message "err: %s" (buffer-string))
    • )
    •  )
      
      (loop for pair in (mapcar (lambda (str) (split-string str "="))
      (split-string
      (buffer-substring (point-min) (point-max)) "&"))
      @@ -384,7 +397,7 @@
      (oauth-hexify-string (cdr pair)))))
      oauth-post-vars-alist)))
      ,@(oauth-headers-to-curl url-request-extra-headers))))
    • (apply 'call-process "curl" nil t nil curl-args))
    • (apply 'call-process oauth-path-curl nil t nil curl-args))
      (url-mark-buffer-as-dead (current-buffer))
      (current-buffer))
@lvijay

This comment has been minimized.

Show comment Hide comment
@lvijay

lvijay Jun 3, 2011

Fix for the issue when retrieving access-token and access-token-secret

diff --git a/oauth.el b/oauth.el
--- a/oauth.el
+++ b/oauth.el
@@ -320,7 +320,9 @@
       (when linebreak
         (delete-region (point-min) linebreak)))
     (goto-char (point-max))
-    (delete-region (point-min) (+ (search-backward "\r\n") 2))
+    (let ((line-end (search-backward "\r\n" nil t nil)))
+      (when line-end
+        (delete-region (point-min) (+ line-end 2))))
     (loop for pair in (mapcar (lambda (str) (split-string str "="))
                               (split-string
                                (buffer-substring (point-min) (point-max)) "&"))

lvijay commented Jun 3, 2011

Fix for the issue when retrieving access-token and access-token-secret

diff --git a/oauth.el b/oauth.el
--- a/oauth.el
+++ b/oauth.el
@@ -320,7 +320,9 @@
       (when linebreak
         (delete-region (point-min) linebreak)))
     (goto-char (point-max))
-    (delete-region (point-min) (+ (search-backward "\r\n") 2))
+    (let ((line-end (search-backward "\r\n" nil t nil)))
+      (when line-end
+        (delete-region (point-min) (+ line-end 2))))
     (loop for pair in (mapcar (lambda (str) (split-string str "="))
                               (split-string
                                (buffer-substring (point-min) (point-max)) "&"))
@MatthewDarling

This comment has been minimized.

Show comment Hide comment
@MatthewDarling

MatthewDarling Jan 26, 2013

I was getting the "search failed: ^M" message using Tumblesocks on Windows, and we found (as @lvijay did) that the problem was related to that call for delete-region.

Could one of these patches be merged to solve the issue? Many thanks for making this package available :)

I was getting the "search failed: ^M" message using Tumblesocks on Windows, and we found (as @lvijay did) that the problem was related to that call for delete-region.

Could one of these patches be merged to solve the issue? Many thanks for making this package available :)

@psanford psanford closed this in d93039d Jan 28, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment