summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2014-04-17 19:21:35 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2014-04-17 19:21:35 +0000
commitfcef386e7515078851ab94c8b3c2686b09cacd96 (patch)
tree9c746953362692b25805582e403b32ec433c4f96 /tests
parent9ff9d2902caf8a85c5019c11214d73e67053ba69 (diff)
downloadliboauth-master.tar.gz
Diffstat (limited to 'tests')
-rw-r--r--tests/commontest.c2
-rw-r--r--tests/oauthbodyhash.c19
-rw-r--r--tests/oauthdatapost.c2
-rw-r--r--tests/oauthexample.c2
-rw-r--r--tests/oauthtest.c2
-rw-r--r--tests/oauthtest2.c2
-rw-r--r--tests/selftest_eran.c2
-rw-r--r--tests/selftest_other.c2
8 files changed, 22 insertions, 11 deletions
diff --git a/tests/commontest.c b/tests/commontest.c
index f1892ca..ab57ed3 100644
--- a/tests/commontest.c
+++ b/tests/commontest.c
@@ -3,7 +3,7 @@
* @file commontest.c
* @author Robin Gareus <robin@gareus.org>
*
- * Copyright 2007, 2008 Robin Gareus <robin@gareus.org>
+ * Copyright 2007, 2008, 2012 Robin Gareus <robin@gareus.org>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/oauthbodyhash.c b/tests/oauthbodyhash.c
index eb3ff3f..b71eb08 100644
--- a/tests/oauthbodyhash.c
+++ b/tests/oauthbodyhash.c
@@ -3,7 +3,7 @@
* @file oauthbodysign.c
* @author Robin Gareus <robin@gareus.org>
*
- * Copyright 2009 Robin Gareus <robin@gareus.org>
+ * Copyright 2009, 2012 Robin Gareus <robin@gareus.org>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -43,7 +43,14 @@ int my_data_post(char *url, char *data) {
char *sig_url;
bh=oauth_body_hash_data(strlen(data), data);
- uh = oauth_catenc(2, url, bh);
+ uh = (char*) malloc((strlen(url)+strlen(bh)+2) * sizeof(char));
+ if (!uh) return -1;
+
+ strcat(uh, url);
+ strcat(uh, "?");
+ strcat(uh, bh);
+
+ printf("URL: %s\n", uh);
req_url = oauth_sign_url2(uh, &postarg, OA_HMAC, NULL, c_key, c_secret, t_key, t_secret);
printf("POST: %s?%s\n", req_url, postarg);
if (uh) free(uh);
@@ -53,8 +60,12 @@ int my_data_post(char *url, char *data) {
reply = oauth_post_data(sig_url, data, strlen(data), "Content-Type: application/json");
if(sig_url) free(sig_url);
- printf("REPLY: %s\n", reply);
- if(reply) free(reply);
+ if (reply) {
+ printf("REPLY: %s\n", reply);
+ free(reply);
+ } else {
+ printf("Error performing the request\n");
+ }
return 0;
}
diff --git a/tests/oauthdatapost.c b/tests/oauthdatapost.c
index 9bd2e1d..2f5c7f0 100644
--- a/tests/oauthdatapost.c
+++ b/tests/oauthdatapost.c
@@ -3,7 +3,7 @@
* @file oauthimageupload.c
* @author Robin Gareus <robin@gareus.org>
*
- * Copyright 2008 Robin Gareus <robin@gareus.org>
+ * Copyright 2008, 2012 Robin Gareus <robin@gareus.org>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/oauthexample.c b/tests/oauthexample.c
index fb5915d..138e858 100644
--- a/tests/oauthexample.c
+++ b/tests/oauthexample.c
@@ -3,7 +3,7 @@
* @file oauthexample.c
* @author Robin Gareus <robin@gareus.org>
*
- * Copyright 2008 Robin Gareus <robin@gareus.org>
+ * Copyright 2008, 2010 Robin Gareus <robin@gareus.org>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/oauthtest.c b/tests/oauthtest.c
index e06cb30..3882abf 100644
--- a/tests/oauthtest.c
+++ b/tests/oauthtest.c
@@ -3,7 +3,7 @@
* @file oauthtest.c
* @author Robin Gareus <robin@gareus.org>
*
- * Copyright 2007, 2008 Robin Gareus <robin@gareus.org>
+ * Copyright 2007, 2008, 2010 Robin Gareus <robin@gareus.org>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/oauthtest2.c b/tests/oauthtest2.c
index fe4cbbb..ae91bcf 100644
--- a/tests/oauthtest2.c
+++ b/tests/oauthtest2.c
@@ -4,7 +4,7 @@
* @file oauthtest.c
* @author Robin Gareus <robin@gareus.org>
*
- * Copyright 2010 Robin Gareus <robin@gareus.org>
+ * Copyright 2010, 2011 Robin Gareus <robin@gareus.org>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/selftest_eran.c b/tests/selftest_eran.c
index 7e118d4..d80abc2 100644
--- a/tests/selftest_eran.c
+++ b/tests/selftest_eran.c
@@ -6,7 +6,7 @@
* This code contains examples provided by Eran Hammer-Lahav
* on the oauth.net mailing list.
*
- * Copyright 2008 Robin Gareus <robin@gareus.org>
+ * Copyright 2008, 2009 Robin Gareus <robin@gareus.org>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/selftest_other.c b/tests/selftest_other.c
index 31ed557..5879d72 100644
--- a/tests/selftest_other.c
+++ b/tests/selftest_other.c
@@ -3,7 +3,7 @@
* @file selftest.c
* @author Robin Gareus <robin@gareus.org>
*
- * Copyright 2009 Robin Gareus <robin@gareus.org>
+ * Copyright 2009, 2010, 2012 Robin Gareus <robin@gareus.org>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal