[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: urlencode base64
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: urlencode base64 |
Date: |
Mon, 01 Oct 2018 17:27:17 +0200 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new b1920f975 urlencode base64
b1920f975 is described below
commit b1920f97583d6a75c4886715aa0335699c9af13a
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Mon Oct 1 17:27:14 2018 +0200
urlencode base64
---
src/rest-plugins/plugin_rest_openid_connect.c | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/rest-plugins/plugin_rest_openid_connect.c
b/src/rest-plugins/plugin_rest_openid_connect.c
index 2bcf576fb..2e68b7f99 100644
--- a/src/rest-plugins/plugin_rest_openid_connect.c
+++ b/src/rest-plugins/plugin_rest_openid_connect.c
@@ -648,7 +648,7 @@ return_userinfo_response (void *cls)
}
/**
- * Returns base64 encoded string without padding
+ * Returns base64 encoded string urlencoded
*
* @param string the string to encode
* @return base64 encoded string
@@ -657,12 +657,27 @@ static char*
base_64_encode(const char *s)
{
char *enc;
+ char *enc_urlencode;
char *tmp;
+ int i;
+ int num_pads = 0;
GNUNET_STRINGS_base64_encode(s, strlen(s), &enc);
- tmp = strrchr (enc, '=');
- *tmp = '\0';
- return enc;
+ tmp = strchr (enc, '=');
+ num_pads = strlen (enc) - (tmp - enc);
+ GNUNET_assert ((3 > num_pads) && (0 <= num_pads));
+ if (0 == num_pads)
+ return enc;
+ enc_urlencode = GNUNET_malloc (strlen (enc) + num_pads*2);
+ strcpy (enc_urlencode, enc);
+ GNUNET_free (enc);
+ tmp = strchr (enc_urlencode, '=');
+ for (i = 0; i < num_pads; i++)
+ {
+ strcpy (tmp, "%3D"); //replace '=' with '%3D'
+ tmp += 3;
+ }
+ return enc_urlencode;
}
/**
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: urlencode base64,
gnunet <=