diff options
author | Eduardo Chappa <chappa@washington.edu> | 2021-06-10 20:15:14 -0600 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2021-06-10 20:15:14 -0600 |
commit | c7aed72b5ec34501f488b96591bbc018f76d351f (patch) | |
tree | bcc6b488e2aeae537c92f3b2aee5770843cfadca /imap/src/c-client/oauth2_aux.c | |
parent | affb946709254a8c6f68409e2ffb6d36f7d38edd (diff) | |
download | alpine-c7aed72b5ec34501f488b96591bbc018f76d351f.tar.xz |
* Rewrite of http code to keep connections alive after GET and POST
commands.
Diffstat (limited to 'imap/src/c-client/oauth2_aux.c')
-rw-r--r-- | imap/src/c-client/oauth2_aux.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/imap/src/c-client/oauth2_aux.c b/imap/src/c-client/oauth2_aux.c index ad1c07de..0ecd0730 100644 --- a/imap/src/c-client/oauth2_aux.c +++ b/imap/src/c-client/oauth2_aux.c @@ -104,6 +104,7 @@ JSON_S *oauth2_json_reply(OAUTH2_SERVER_METHOD_S RefreshMethod, OAUTH2_S *oauth2 { JSON_S *json = NULL; HTTP_PARAM_S params[OAUTH2_PARAM_NUMBER]; + HTTPSTREAM *stream; unsigned char *s; char *server = NULL; @@ -111,11 +112,14 @@ JSON_S *oauth2_json_reply(OAUTH2_SERVER_METHOD_S RefreshMethod, OAUTH2_S *oauth2 *status = 0; server = xoauth2_server(RefreshMethod.urlserver, oauth2->param[OA2_Tenant].value); if(strcmp(RefreshMethod.name, "POST") == 0 - && ((s = http_post_param(server, params, status)) != NULL)){ + && ((stream = http_open(server)) != NULL) + && ((s = http_post_param(stream, params)) != NULL)){ unsigned char *u = s; json = json_parse(&u); fs_give((void **) &s); } + *status = stream->status ? stream->status->code : -1; + if(stream) http_close(stream); if(server) fs_give((void **) &server); |