Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request problems #12

Open
MadEarl opened this issue Oct 24, 2022 · 1 comment
Open

request problems #12

MadEarl opened this issue Oct 24, 2022 · 1 comment

Comments

@MadEarl
Copy link

MadEarl commented Oct 24, 2022

Hi,

I've for a while been experiencing problems with requests against JIRA Cloud.

When using the default curl backend of request, I'm running into what seems to be a race condition when updating the Ejira agenda. At some point, the update process fails with the error »semaphore never called«.

When instead using url-retrieve as request backend, the update process works fine (and much quicker than with curl for some reason), but I get botched encoding in Org. I traced the error back to this function, where replacing 'no-conversion with 'cp1252 (wtf?) fixes the issue:

(defun request--parse-data (response encoding parser)
  "In RESPONSE buffer, decode via ENCODING, then send to PARSER."
  (let ((buffer (request-response--buffer response)))
    (when (buffer-live-p buffer)
      (with-current-buffer buffer
        (request-log 'trace "request--parse-data: %s" (buffer-string))
        (unless (eq (request-response-status-code response) 204)
          (recode-region (point-min) (point-max) encoding 'cp1252) ; <-- Jira sending Windows-1252?
          (goto-char (point-min))
          (setf (request-response-data response)
                (if parser (funcall parser) (buffer-string))))))))

This is of course just a hack, but I don't know how to proceed from here. Any suggestions? I'm on Emacs 28.1, BTW, with the latest request.el from Elpa, request-20221004.1331 as of this writing.

@MadEarl
Copy link
Author

MadEarl commented Nov 22, 2022

The non-hacky fix is to wrap all :data fields in (encode-coding-string ... 'utf-8). This way, sync works flawlessly with the url-retrieve backend, which, at least with my setup, is much quicker than curl and, most importantly, does not fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant