Closed gzqx closed 4 years ago
Please run with :Calendar -debug
and check the response in ~/.cache/calendar.vim/download/.
It is empty
You mean empty response? Or empty directory?
empty directory.
Hmm, the message Fail in authorization to Google
is shown after a http request to the api and there should be some response file. Can you test with let g:calendar_debug = 1
again? Or you configure g:calendar_cache_directory
?
I can reproduce this issue. I think the key is the proxy, but I can't tell what's the problem with the proxy.
After inserting a line echom string(response.content)
between L62-L63
https://github.com/itchyny/calendar.vim/blob/644f88b9ddb17ef04c4558e945d1995aab400a96/autoload/calendar/google/client.vim#L57-L63
Fail in authorization to Google
result is:
'^M^@HTTP/2 200 ^M^@content-type: application/json; charset=utf-8^M^@vary: X-Origin^M^@vary: Referer^M^@vary: Origin,Accept-Encoding^M^@date: Thu, 28 Nov 2019 15:26:01 GMT^M^@serve
r: ESF^M^@cache-control: private^M^@x-xss-protection: 0^M^@x-frame-options: SAMEORIGIN^M^@x-content-type-options: nosniff^M^@accept-ranges: none^M^@^M^@{^@ "access_token": "ya29.I
l-zB7Ld3a6o6E0ub5O_HqLOuD5KPz_n4EGcLQx2a8zM-2mhzTgCpHAU7i2R1hVmKMiznayIRAFgvR8tRAmdP8RG1l7FlUmytLGcUmTgVhUBnSY9ZC1dSE_lkE68e-Oq7g",^@ "expires_in": 3600,^@ "refresh_token": "1//0
eBfBnwNGtjtaCgYIARAAGA4SNwF-L9IrF_U5u2ks2qfUSzc6fiPqVsf1jl6_GRmaVh4vepgEuLJa2rzxslVE-D-3iVtmu86O7do",^@ "scope": "https://www.googleapis.com/auth/calendar https://www.googleapis.c
om/auth/tasks",^@ "token_type": "Bearer"^@}'
authorize successfully:
CODE: 4/twHXe1rdhwP9a0OSwUfYtK4lhKNfTnU52qcS3BP2l7Ye6H3QOgFLAqY'^M^@{^@ "access_token": "ya29.Il-zB4XtOgQ1X-ZUhb1rHmJTOZl0HexQ1zOFDb1BeFjiF0jdl9E2XNOF7LQsg46OxSOm0rrLWEHFgtlkuXDkG
fochZjDcZmazMziZy02zsO4fC20ggRHTxhAg9woLnnaWg",^@ "expires_in": 3600,^@ "refresh_token": "1//0eG6dfdNTD4qzCgYIARAAGA4SNwF-L9IrwSfPYdXNbLB0jNCFlk3LIhXfk7Tg3bsLhQeYU8MGVwtMd35iFf7Q
yOW6r27ykG43HVw",^@ "scope": "https://www.googleapis.com/auth/tasks https://www.googleapis.com/auth/calendar",^@ "token_type": "Bearer"^@}'
Oh, proxy problem #111. So HTTPS_PROXY does not work? Adding -x ...
option in s:command
in webapi.vim solves the issue?
HTTPS_PROXY
is OK. the failed response.content
has access_token
, but the response json schema is not the same. Later on I'm going to echo s:command
and execute it manually.
Thank you for your response.
I found the problem about my proxy. It can't handle curl with http2 very well.
If I add the option --http1.1
to curl, it works good.
curl --http1.1 -k -i -N -X POST -H "Content-Length: 265" --data-binary @"urlencoded-form" "https://accounts.google.com/o/oauth2/token"
Thanks for information, I added the --http1.1
flag for now (in my environment HTTP/2 also works but there's no reason to stick to HTTP/2).
Thanks a lot.
The problem is solved and thanks a lot.
@guzhaqixin May using socks5 protocol proxy instead of http, if you run into 401 invalid credentials. cause http proxy wraps http status code, curl never gets remote server 401 code.
curl https://ip.gs/404 -i -x http://localhost:6152
note the first line:
HTTP/1.0 200 Connection established
HTTP/2 404
date: Fri, 29 Nov 2019 11:15:58 GMT
content-type: text/html
set-cookie: __cfduid=ded4da53b6e72ac1dce2878a0994360901575026158; expires=Sun, 29-Dec-19 11:15:58 GMT; path=/; domain=.ip.gs; HttpOnly
vary: Accept-Encoding
cf-cache-status: DYNAMIC
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
server: cloudflare
cf-ray: 53d42aaf1eb6463c-TPE
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>
curl https://ip.gs/404 -i -x socks5://localhost:6153
HTTP/2 404
date: Fri, 29 Nov 2019 11:16:10 GMT
content-type: text/html
set-cookie: __cfduid=dd0ff3b64fd8498932b46af06d649650f1575026170; expires=Sun, 29-Dec-19 11:16:10 GMT; path=/; domain=.ip.gs; HttpOnly
vary: Accept-Encoding
cf-cache-status: DYNAMIC
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
server: cloudflare
cf-ray: 53d42afbdbe64642-TPE
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>
Problem I have
in my vimrc, and get
[calendar] Fail in authorization to Google
after pasted the requested code. I have tried to remove all files in~/.cache/calendar.vim/
Environment Information
wget www.google.com
works fine.