-
Notifications
You must be signed in to change notification settings - Fork 934
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
Response.status_code is 0 and response.text is empty for some of my users #1100
Comments
Hello, Session.cpp: 187 curl_easy_setopt(curl_->handle, CURLOPT_CERTINFO, 1L); On response CURL Version 8.8-dev. P.S According to CURL Docs CURLOPT_CERTINFO my backend is supporting. I'll continue work on solution and check where is error. Please wait news from me! Where did you get it from? Additional Context/Your Environment |
@Enziferum thanks for looking into it and @typeshi12 thanks for reporting. Please check the following curl issue for it: jeroen/curl#127 To me it does not make sense that removing One wild guess I would have is: Do the uses affected only have a IPv6 address and your server is only reachable via IPv4 (https://myip.wtf/)? |
@COM8 Thanks for fast answer! P.S @COM8 I'll make PR tomorrow. OK ?) |
According to my cloudflare settings, ipv6 support is enabled and is not able to be turned off anyway lol. |
@typeshi12 Thanks for response! #include "curl/curl.h"
#include <iostream>
size_t writeFunction(void* ptr, size_t size, size_t nmemb, std::string* data) {
data->append((char*)ptr, size * nmemb);
return size * nmemb;
}
int main(int argc, char* argv[])
{
auto curl = curl_easy_init();
if (!curl)
return -1;
curl_easy_setopt(curl, CURLOPT_URL, "https://getsolara.dev/api/endpoint.json");
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L);
curl_version_info_data* version_info = curl_version_info(CURLVERSION_NOW);
const std::string version = "curl/" + std::string{ version_info->version };
curl_easy_setopt(curl, CURLOPT_USERAGENT, version.c_str());
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L);
curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
std::string response_string;
std::string header_string;
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeFunction);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response_string);
curl_easy_setopt(curl, CURLOPT_HEADERDATA, &header_string);
auto code = curl_easy_perform(curl);
char* url;
long response_code;
double elapsed;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &elapsed);
curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url);
if (response_code == 200)
std::cout << "Success Request" << std::endl;
else
std::cerr << "UnSuccess Request" << std::endl;
std::cout << "Response: \n" << response_string << std::endl;
std::cout << "Headers: \n" << header_string << std::endl;
curl_easy_perform(curl);
curl_easy_cleanup(curl);
curl = NULL;
return 0;
} |
Had a user with this issue run this code - it returned empty for him, however it was successful for me. |
@typeshi12 |
Alright, do you have discord? or what communications do you prefer |
Hi all, experiencing the same issue on our window server box. The request fails with |
So I've dug in more, I observed the issue with two SSL certificates, one from Let's Encrypt and one from Google Trusted Host via cloudflare. The following oid's appear when validating the certification (thanks @Enziferum for your investigation):
These do not appear in libcurl's OID tables but a recent change to libcurl made this an explicit error: Previously this was not an error, in a newer commit more known OID are added so this shouldn't be an issue if libcurl is updated: So generally the proper fix is for CPR to update to a newer libcurl later to incorporate these new OID. For users, these are the options:
|
@rminderhoud good catch! I will work on an update to libcurl 8.10.1 this weekend. |
Description
Hello,
I am a developer for a product that uses CPR to access various apis. However, a good sum of my users (not me, however) are encountering an issue accessing my website through CPR / cURL.
I set up some debug message boxes, and this is what it shows on two users:
The code behind that messagebox is this:
Addtionally, I had the users run a curl request to the same endpoint, which brings up this error for both users:
curl: (35) schannel: next InitializeSecurityContext failed: SEC_E_INVALID_TOKEN (0x80090308) - The token supplied to the function is invalid
Now this may not even be a CPR issue but rather a cURL issue, but seeing this is the library I'm using, I thought I'd try here first.
And before you say its an ISP block / country block issue, it's not. While a Vpn DOES fix this issue, it's still clearly not a block as the users can access the api endpoints just fine in their browser WITHOUT a vpn:
Example/How to Reproduce
curl 'https://getsolara.dev/api/endpoint.json'
in a CMD promptPossible Fix
A noticed that with using a VPN, the vpn uses a different IP to connect to the API (there are three) rather than what is seemingly the default IP. Not experienced much with C++ but maybe you can try getting a request to the different IPs.
Where did you get it from?
vcpkg
Additional Context/Your Environment
The text was updated successfully, but these errors were encountered: