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

Ensure consecutive request calls overwrite all the request options #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rubs33
Copy link

@rubs33 rubs33 commented Feb 4, 2021

There is a bug in the class DuoAPI\CurlRequester: since it is using the same curl resource (the property "ch") for multiple (consecutive) requests, it is supposed to overwrite all the curl options. Otherwise, a request with method DELETE followed by a request with method POST will fail.

The reason is that when a request with method DELETE is done, it sets the option CURLOPT_CUSTOMREQUEST with DELETE. But when the consecutive request with method POST is done, it only sets the option CURLOPT_POST with true, but CURLOPT_CUSTOMREQUEST is kept with the value from the previous request (DELETE).

To fix it, I prepared a change to ensure all the curl options are overwritten for each new request.

A similar problem may occur in the class DuoAPI\FileRequester, when a request is made using POST (with data to post), then a second request is made without any data to post.

@jeffreyparker
Copy link
Contributor

Hi @rubs33, thank you for your contribution!

We were previously notified of the DELETE issue and have already fixed it in this commit cdfa10e by unsetting CURLOPT_CUSTOMREQUEST on GETs and POSTs.

In our testing this has already fixed the issue. Are you still experiencing this issue with the master or 1.0.3 version of this SDK?

I agree that DuoAPI\FileRequester has a similar problem. Will will test and verify that fix. Thank you!

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

Successfully merging this pull request may close these issues.

3 participants