--text follows this line-- 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 (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/post") (method "POST")) (url-retrieve url 'http-handle-response (append (list method url (format "*HTTP %s %s*" method url)) '()))) t) ;; the following curl command will return response very quickly curl -X POST https://identity.xero.com/connect/token -H 'Authorization: Basic abc' -H 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'abc=def' Response: {"error":"invalid_client"} In GNU Emacs 27.2 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G95)) of 2021-03-28 built on builder10-14.porkrind.org Windowing system distributor 'Apple', version 10.3.2022 System Description: macOS 11.4 Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Configured using: 'configure --with-ns '--enable-locallisppath=/Library/Application Support/Emacs/${version}/site-lisp:/Library/Application Support/Emacs/site-lisp' --with-modules' Configured features: NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS JSON PDUMPER GMP Important settings: value of $LANG: en_AU.UTF-8 locale-coding-system: utf-8-unix Major mode: Fundamental Minor modes in effect: tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs text-property-search seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date subr-x cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads kqueue cocoa ns multi-tty make-network-process emacs) Memory information: ((conses 16 45081 6477) (symbols 48 5924 1) (strings 32 15291 1697) (string-bytes 1 507781) (vectors 16 10217) (vector-slots 8 127225 14272) (floats 8 19 50) (intervals 56 185 0) (buffers 1000 12))