"Hack: remember the last xsrf token by host in case we catch cookie jar in transition. The proper fix is to sempahore between competing curl processes.")
"Ensure that REST calls to the jupyter server have the correct _xsrf argument."
(let*((host(url-host(url-generic-parse-urlurl)))
(cookies(request-cookie-alisthost"/"securep))
(xsrf(or(cdr(assoc-string"_xsrf"cookies))
(gethashhostein:query-xsrf-cache))))
(ein:log'debug"EIN:QUERY-PREPARE-HEADER: Found xsrf: %s"xsrf)
(setqsettings(plist-putsettings:headers
(append(plist-getsettings:headers)
(list(cons"User-Agent""Mozilla/5.0")))))
(whenxsrf
(setqsettings(plist-putsettings:headers
(append(plist-getsettings:headers)
(list(cons"X-XSRFTOKEN"xsrf)))))
(setf(gethashhostein:query-xsrf-cache)xsrf))
(setqsettings(plist-putsettings:encoding'binary))
settings))
(let((checked-curl-versionnil))
(defunein:warn-on-curl-version()
(let((curl(executable-findrequest-curl)))
(unlesschecked-curl-version
(setqchecked-curl-versiont)
(with-temp-buffer
(call-processcurlniltnil"--version")
(goto-char(point-min))
(when(search-forward"mingw32"nilt)
(warn"The current version of curl (%s) may not work with ein. We recommend you install the latest, official version from the curl website: https://curl.haxx.se"(buffer-string))))))))