Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameters do not seem to be resetting #30

Closed
patrickjennings opened this issue May 26, 2015 · 3 comments
Closed

Parameters do not seem to be resetting #30

patrickjennings opened this issue May 26, 2015 · 3 comments

Comments

@patrickjennings
Copy link

In 1.26 and the latest in this repository, I have found that the parameters used to create each URI are not being reset after subsequent calls to some methods used in flickcurl. Please look at the following Gist as an example:

https://gist.github.com/patrickjennings/0d5657d2463395c4e229

The program fails at flickcurl_oauth_create_access_token because the parameters used in the call to flickcurl_oauth_create_request_token are still present in the URI created for the call. If I do not use the function flickcurl_oauth_create_request_token before flickcurl_oauth_create_access_token, the program works properly.

Is there a way to clear the parameters used to create the URI for each API call or should flickcurl reset the parameter list each time an API call is made?

@dajobe
Copy link
Owner

dajobe commented May 26, 2015

Looks like it is repeating parameters and has some garbage values too like a timestamp of '%40xy%01'

@dajobe
Copy link
Owner

dajobe commented May 29, 2015

I've a candidate flaw; the wrong function is called in those methods to reset the parameters.

Candidate fix:

diff --git a/src/oauth.c b/src/oauth.c
index 8ac4e3c..95f09a2 100644
--- a/src/oauth.c
+++ b/src/oauth.c
@@ -709,7 +709,7 @@ flickcurl_oauth_create_request_token(flickcurl* fc, const char* callback)
   int i;
   int count;

-  flickcurl_end_params(fc);
+  flickcurl_init_params(fc, 0);

   /* Require signature */
   flickcurl_set_sign(fc);
@@ -857,7 +857,7 @@ flickcurl_oauth_create_access_token(flickcurl* fc, const char* verifier)
   if(!verifier)
     return 1;

-  flickcurl_end_params(fc);
+  flickcurl_init_params(fc, 0);

   /* Require signature */
   flickcurl_set_sign(fc);

@patrickjennings
Copy link
Author

I tested the fix. Everything seems to work afterwards. Thank you for taking the time to create and maintain this library!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants