Hi Lars,

Thanks for looking into this.
I did the following, pls help to see if it helps.

1. Emacs from Homebrew Install Emacs using Homebrew in MacOS Big Sur.
- Install using
brew install emacs
- Got an Emacs in Terminal withou GUI
- Pasted the following
(setq url-debug t)

(defun http-handle-response (status method &optional url bufname raw stay-in-window)
  "Switch to the buffer returned by `url-retreive'.
The buffer contains the raw HTTP response sent by the server."
  (message (format "%s" raw)))

(display-buffer
 (let* ((url "https://identity.xero.com/connect/token")
        (method "POST"))
   (url-retrieve url 'http-handle-response (append (list method url (format "*HTTP %s %s*" method url)) '())))
 t)
- Got response very quickly in the buffer displayed (expected behaviour)
(setq url-debug t)

(defun http-handle-response (status method &optional url bufname raw stay-in-window)
  "Switch to the buffer returned by `url-retreive'.
The buffer contains the raw HTTP response sent by the server."
  (message (format "%s" raw)))

(display-buffer
 (let* ((url "https://identity.xero.com/connect/token")
        (method "POST"))
   (url-retrieve url 'http-handle-response (append (list method url (format "*HTTP %s %s*" method url)) '())))
 t)

2. Install Emacs from  https://emacsformacosx.com/emacs-builds/Emacs-27.2-3-universal.dmg
- start Emacs from command line with:
/Applications/Emacs.app/Contents/MacOS/Emacs --no-init
- execute the above script
- I got the following:
image.png
You could see that the *http... buffer is always empty and stay like that for some time (maybe 30s), and eventually, the mini buffer showed a nil.
image.png

Could this be an issue only for the binary from emacsformacosx?

Regards,
Rui


On Sat, Nov 20, 2021 at 8:49 PM Lars Ingebrigtsen <larsi@gnus.org> wrote:
Rui Yang <ryang.sei@gmail.com> writes:

> Emacs -Q
> ;; the following script hopefully will demonstrate the issue
> ;; after evaluating the code below, url-retrieve seems started a new
> ;; process to do the https call, that call should give a bad request with
> ;; json response {"error":"invalid_client"}
> ;; but it took a lot of time for the call back to be called
> ;; I suspect sth special about Xero domain’s certificate which caused
> ;; this issue. https://www.google.com.au is fine
> ;; tried starting with emacs option, --no-init

I'm unable to reproduce the issue with either Emacs 27.2 or the current
trunk -- with your test case I just get this page:

HTTP/1.1 301 Moved Permanently
Server: AkamaiGHost
Content-Length: 0
Location: https://login.xero.com/identity/user/login

Is there something else needed to reproduce the problem?

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no