oauth2: fix to try ipv6 when getting upstream connection
Add trial to establish upstream connection with FLB_IO_IPV6 mode,
for the environment where the hostname is resolved to ipv6 primarily.
@@ -320,10 +320,15 @@ char *flb_oauth2_token_get(struct flb_oauth2 *ctx)
/* Get Token and store it in the context */
u_conn = flb_upstream_conn_get(ctx->u);
+ if (!u_conn) {
+ ctx->u->flags |= FLB_IO_IPV6;
+ u_conn = flb_upstream_conn_get(ctx->u);
if (!u_conn) {
flb_error("[oauth2] could not get an upstream connection");
+ ctx->u->flags &= ~FLB_IO_IPV6;
return NULL;
}
+ }
/* Create HTTP client context */
c = flb_http_client(u_conn, FLB_HTTP_POST, ctx->uri,
