cpr icon indicating copy to clipboard operation
cpr copied to clipboard

GET requests on github API and raw links return bad host (status code: 0)

Open IngCr3at1on opened this issue 11 years ago • 11 comments

This includes the example in the readme documentation.

IngCr3at1on avatar Nov 06 '15 02:11 IngCr3at1on

Just tried the example in the readme documentation again, and it works just fine. Can you give me a minimal snippet of the request that's bugging out for you?

whoshuu avatar Nov 07 '15 22:11 whoshuu

@IngCr3at1on OS, curl version?

nabijaczleweli avatar Nov 07 '15 23:11 nabijaczleweli

@whoshuu will have to get that later. @nabijaczleweli this occurs in Arch Linux with curl 7.45

IngCr3at1on avatar Nov 09 '15 16:11 IngCr3at1on

I'm having the same issue, but I found out that it happens only if you don't use your system's libcurl and it's just https requests, http works fine. I'm also on Arch Linux with curl 7.45 and OpenSSL 1.0.2.d

vitorhnn avatar Nov 16 '15 22:11 vitorhnn

@vitorhnn aye I've noticed it only seems to happen on https also, I forgot to note that in the initial issue (since all github api and raw links are handled over https I didn't feel this was necessary). I have the same version of OpenSSL also.

As for a snippet of the request it's literally the same one as the example that I was playing with.

@vitorhnn can you elaborate on what you mean by "don't use your system's libcurl"; more specifically was there something you were able to do to make it work?

IngCr3at1on avatar Nov 16 '15 22:11 IngCr3at1on

@vitorhnn, I think the issue you're seeing is related to #31, which has yet to be implemented when building the included curl library. It makes sense that your system curl works just fine, since it's correctly using OpenSSL from your system as well. When #31 is implemented, let's circle back on this issue and see if it's resolved.

whoshuu avatar Nov 16 '15 22:11 whoshuu

@IngCr3at1on, there's an option to either use your system's libcurl or the included one. The option is USE_SYSTEM_CURL (found here) and by default it's OFF. You can turn it on by setting an environment variable (ie, export USE_SYSTEM_CURL=ON), or setting a CMake definition cmake -DUSE_SYSTEM_CURL=ON .. && make.

Additionally, the option should be exposed in the CMake gui if that's what you're using to configure your project.

whoshuu avatar Nov 16 '15 22:11 whoshuu

@IngCr3at1on, set USE_SYSTEM_CURL to ON on your CMakeLists.txt, like here

vitorhnn avatar Nov 16 '15 22:11 vitorhnn

Alright @whoshuu and @vitorhnn I'll try that out. Assuming it works I'll close this being that #31 already exists. Thanks.

IngCr3at1on avatar Nov 16 '15 23:11 IngCr3at1on

@IngCr3at1on And?

nabijaczleweli avatar Aug 16 '16 18:08 nabijaczleweli

Closing this, since it does not seem to be relevant any more.

COM8 avatar Jun 17 '20 15:06 COM8