wolkykim / qlibc

qLibc is a simple and yet powerful C library providing generic data structures and algorithms.
http://wolkykim.github.io/qlibc
Other
984 stars 167 forks source link

hostname or destname #81

Closed winxxp closed 2 years ago

winxxp commented 3 years ago

hostname or destname?????

qhttpclient_t *qhttpclient(const char *destname, int port) {
    bool ishttps = false;
    char hostname[256];
    if (port == 0 || strstr(hostname, "://") != NULL) { // hostname or destname?????
        if (_parse_uri(destname, &ishttps, hostname, sizeof(hostname), &port)
                == false) {
            DEBUG("Can't parse URI %s", destname);
            return NULL;
        }

        DEBUG("https: %d, hostname: %s, port:%d\n", ishttps, hostname, port);
    } else {
        qstrcpy(hostname, sizeof(hostname), destname);
    }
wolkykim commented 2 years ago

Thanks for the report. That appeared to be a bug. I've made a PR to address the issue. Thanks