From fcef386e7515078851ab94c8b3c2686b09cacd96 Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Thu, 17 Apr 2014 19:21:35 +0000 Subject: liboauth-1.0.3 --- tests/commontest.c | 2 +- tests/oauthbodyhash.c | 19 +++++++++++++++---- tests/oauthdatapost.c | 2 +- tests/oauthexample.c | 2 +- tests/oauthtest.c | 2 +- tests/oauthtest2.c | 2 +- tests/selftest_eran.c | 2 +- tests/selftest_other.c | 2 +- 8 files changed, 22 insertions(+), 11 deletions(-) (limited to 'tests') 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 * - * Copyright 2007, 2008 Robin Gareus + * Copyright 2007, 2008, 2012 Robin Gareus * * 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 * - * Copyright 2009 Robin Gareus + * Copyright 2009, 2012 Robin Gareus * * 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 * - * Copyright 2008 Robin Gareus + * Copyright 2008, 2012 Robin Gareus * * 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 * - * Copyright 2008 Robin Gareus + * Copyright 2008, 2010 Robin Gareus * * 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 * - * Copyright 2007, 2008 Robin Gareus + * Copyright 2007, 2008, 2010 Robin Gareus * * 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 * - * Copyright 2010 Robin Gareus + * Copyright 2010, 2011 Robin Gareus * * 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 + * Copyright 2008, 2009 Robin Gareus * * 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 * - * Copyright 2009 Robin Gareus + * Copyright 2009, 2010, 2012 Robin Gareus * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal -- cgit v1.2.1