Closed xfangfang closed 3 years ago
Add curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
and post output. Also check what dkp-pacman -Sl
returns for switch-curl.
@yellows8 thanks~
Here is:
sudo dkp-pacman -Sl | grep switch-curl
dkp-libs switch-curl 7.69.1-3 [installed]
void network_request(void) {
CURL *curl;
CURLcode res;
printf("curl init\n");
curl_global_init(CURL_GLOBAL_DEFAULT);
curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
curl_easy_setopt(curl, CURLOPT_USERAGENT, "libnx curl example/1.0");
// Add any other options here.
printf("curl_easy_perform\n");
consoleUpdate(NULL);
res = curl_easy_perform(curl);
if (res != CURLE_OK) printf("curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
// In an actual app you should return an error on failure, following cleanup.
printf("cleanup\n");
curl_easy_cleanup(curl);
}
curl_global_cleanup();
}
the screen shows:
curl example curl init curl_easy_perform curl_easy_perform() failed: SSL connect error cleanup
Displayed output should've changed with CURLOPT_VERBOSE....
use curl_easy_setopt(curl, CURLOPT_STDERR, fopen("sdmc://curl.txt", "w+")); output the log to file.
log for https :
* timeout on name lookup is not supported
* Trying 93.184.216.34:443...
* Connected to example.com (93.184.216.34) port 443 (#0)
* Closing connection 0
log for http:
* timeout on name lookup is not supported
* Trying 93.184.216.34:80...
* Connected to example.com (93.184.216.34) port 80 (#0)
> GET / HTTP/1.1
Host: example.com
User-Agent: libnx curl example/1.0
Accept: */*
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< Age: 549857
< Cache-Control: max-age=604800
< Content-Type: text/html; charset=UTF-8
< Date: Wed, 20 Jan 2021 15:37:52 GMT
< Etag: "3147526947"
< Expires: Wed, 27 Jan 2021 15:37:52 GMT
< Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT
< Server: ECS (sjc/4E76)
< Vary: Accept-Encoding
< X-Cache: HIT
< Content-Length: 1256
<
* Connection #0 to host example.com left intact
Try other HTTPS URLs? What's your system-version?
That log isn't really useful :/
try other urls, get the same problems.
11.0.0 sxos 3.1.0
(I don't find openssl upder /opt/devkitpro/portlibs/switch/lib)
make outputs
make
linking curl.elf
aarch64-none-elf-g++ -specs=/opt/devkitpro/libnx/switch.specs -g -march=armv8-a+crc+crypto -mtune=cortex-a5
7 -mtp=soft -fPIE -Wl,-Map,curl.map main.o -L/opt/devkitpro/portlibs/switch/lib -L/opt/devkitpro/libnx/lib
-L/opt/devkitpro/portlibs/switch/lib -lcurl -lnx -lz -lnx -o /Users/fang/project/ns/sw
itch-examples/network/curl/curl.elf
built ... curl.nacp
built ... curl.nro
Can you try vanilla AMS?
It may take some time to switch the system. I'll update it when I'm done.
And my previous build file : curl.nro
thank you very much. After change to AMS, https is good.
I can't access HTTPS using curl, even the default sample program can't access it normally, but when I change it to HTTP, I can access it normally. Is there a problem with my environment configuration or does curl not support HTTPS on Switch? Thank you for someone who can solve my problem~
and by the way,is it possible for ffmpeg to support HTTPS?