Homebrew Curl can't resolve hostname

IC_

GBAtemp's ???
OP
Member
Joined
Aug 24, 2017
Messages
1,569
Trophies
1
Location
The Forest
XP
5,477
Country
Antarctica
Hello, I'm trying to download files using CURL but it always just shows some weird errors about not being able to resolve hostnames and I wasn't really able to find anything about it
The internet settings on my 3DS are correct and everything
The errors:
Code:
* timeout on name lookup is not supported
* Curl_ipv4_resolve_r failed for [domain]
* Couldn't resolve host '[domain]'
* Closing connection 0
The code:
Code:
void http_init() {
    curl_global_init(CURL_GLOBAL_ALL);
}

void http_exit() {
    curl_global_cleanup();
}

static size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream) {
    size_t written = fwrite(ptr, size, nmemb, (FILE *)stream);
    return written;
}

unsigned char http_downloadfile(const char* url, const char* filename) {
    std::cout << url << ", " << filename << '\n';
    CURL *curl_handle;
    CURLcode cres;
    FILE *file;
    
    /* init the curl session */
    curl_handle = curl_easy_init();
    
    /* set URL to get here */
    curl_easy_setopt(curl_handle, CURLOPT_URL, url);
    
    /* Switch on full protocol/debug output while testing */
    curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1L);
    
    /* disable progress meter, set to 0L to enable it */
    curl_easy_setopt(curl_handle, CURLOPT_NOPROGRESS, 1L);
    
    /* send all data to this function  */
    curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_data);
    
    curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1L);
    
    curl_easy_setopt(curl_handle, CURLOPT_FAILONERROR, 1L);
    
    curl_easy_setopt(curl_handle, CURLOPT_HTTP_VERSION, (long)CURL_HTTP_VERSION_2TLS);
    
    curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0L);
    
    curl_easy_setopt(curl_handle, CURLOPT_STDERR, stdout);
    
    //Open file
    file = fopen(filename, "wb");
    if(file) {
        /* write the page body to this file handle */
        curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, file);
        
        /* get it! */
        cres = curl_easy_perform(curl_handle);
        
        /* close the header file */
        fclose(file);
    } else {
        //Unable to open file
        std::cout << "Unable to open file in http_downloadfile\n";
        return 255;
    }
    
    curl_easy_cleanup(curl_handle);
    
    if (cres != CURLE_OK) {
        return 128;
    }
    
    return 0;
}
 

IC_

GBAtemp's ???
OP
Member
Joined
Aug 24, 2017
Messages
1,569
Trophies
1
Location
The Forest
XP
5,477
Country
Antarctica

IC_

GBAtemp's ???
OP
Member
Joined
Aug 24, 2017
Messages
1,569
Trophies
1
Location
The Forest
XP
5,477
Country
Antarctica
This looks weird, are you adding the https://www part?
I'm adding http:// or https:// but not www because the website doesn't require it and IP addresses don't have that, I just tried with www though and it's the same error
And also when I use an IP address it just says
Code:
* timeout on name lookup is not supported
* Closing connection 0
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    Sonic Angel Knight @ Sonic Angel Knight: DAYTONAAAAAAAA!!!!!!!!!!