char* oidc_util_http_query_encoded_url(request_rec *r, const char *url,
		const apr_table_t *params) {
	char *result = NULL;
	if ((params != NULL) && (apr_table_elts(params)->nelts > 0)) {
		oidc_http_encode_t data = { r, NULL };
		apr_table_do(oidc_util_http_add_form_url_encoded_param, &data, params,
				NULL);
		const char *sep = NULL;
		if (data.encoded_params)
			sep = strchr(url ? url : "", OIDC_CHAR_QUERY) != NULL ?
					OIDC_STR_AMP :
					OIDC_STR_QUERY;
		result = apr_psprintf(r->pool, "%s%s%s", url, sep ? sep : "",
				data.encoded_params ? data.encoded_params : "");
	} else {
		result = apr_pstrdup(r->pool, url);
	}
	oidc_debug(r, "url=%s", result);
	return result;
}
char* oidc_util_http_query_encoded_url(request_rec *r, const char *url,
		const apr_table_t *params) {
	char *result = NULL;
	if ((params != NULL) && (apr_table_elts(params)->nelts > 0)) {
		oidc_http_encode_t data = { r, NULL };
		apr_table_do(oidc_util_http_add_form_url_encoded_param, &data, params,
				NULL);
		const char *sep = NULL;
		if (data.encoded_params)
			sep = strchr(url ? url : "", OIDC_CHAR_QUERY) != NULL ?
					OIDC_STR_AMP :
					OIDC_STR_QUERY;
		result = apr_psprintf(r->pool, "%s%s%s", url, sep ? sep : "",
				data.encoded_params ? data.encoded_params : "");
	} else {
		result = apr_pstrdup(r->pool, url);
	}
	oidc_debug(r, "url=%s", result);
	return result;
}