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

CURL return value not being interpreted correctly #17

Open
digitaldan opened this issue Sep 8, 2023 · 0 comments
Open

CURL return value not being interpreted correctly #17

digitaldan opened this issue Sep 8, 2023 · 0 comments

Comments

@digitaldan
Copy link

on line 194 the httpRes is being set to the http response code, so like 200 on a success.

switch_curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes);
switch_curl_easy_cleanup(curl_handle);
switch_curl_slist_free_all(headers);
if (query != url_template) switch_safe_free(query);
return httpRes;

but then on line 213 that gets treated as a CURL internal return code, where 0 is OK. So for me this always fails and while the message does post, mod_apn thinks that it did not and fails the call.

if (do_curl(event, profile) == CURLE_OK) {
ret = SWITCH_TRUE;
}
return ret;
}

I'm confused how this is working for anyone ? I have changed it so do_curl returns

return httpRes >= 200 && httpRes < 300;

and then check this with

if (do_curl(event, profile)) {
  ret = SWITCH_TRUE;
}

And this seems to work now, but i'm unclear how this was working before ?

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

1 participant