Mercurial > dovecot > core-2.2
diff src/lib-oauth2/oauth2-refresh.c @ 21646:7f927c405b2f
lib-oauth2: Support basic authorization
author | Aki Tuomi <aki.tuomi@dovecot.fi> |
---|---|
date | Tue, 21 Feb 2017 11:18:37 +0200 |
parents | f6d27a985066 |
children | 8afc52576667 |
line wrap: on
line diff
--- a/src/lib-oauth2/oauth2-refresh.c Mon Feb 20 14:50:39 2017 +0200 +++ b/src/lib-oauth2/oauth2-refresh.c Tue Feb 21 11:18:37 2017 +0200 @@ -119,11 +119,11 @@ req->re_callback = callback; req->re_context = context; - const char *_url = req->set->refresh_url; - if (http_url_parse(_url, NULL, 0, pool, &url, &error) < 0) { + if (http_url_parse(req->set->refresh_url, NULL, HTTP_URL_ALLOW_USERINFO_PART, + pool, &url, &error) < 0) { fail.error = t_strdup_printf("http_url_parse(%s) failed: %s", - _url, error); + req->set->refresh_url, error); oauth2_refresh_callback(req, &fail); return req; } @@ -141,6 +141,9 @@ struct istream *is = i_stream_create_from_string(payload); + if (url->user != NULL) + http_client_request_set_auth_simple(req->req, url->user, url->password); + http_client_request_add_header(req->req, "Content-Type", "application/x-www-form-urlencoded");