Skip to content

KBEngine.urlopen超时配置 #128

@KBEngineLab

Description

@KBEngineLab
pContext_ = (void*)curl_easy_init();
curl_easy_setopt((CURL*)pContext_, CURLOPT_PRIVATE, (void*)this);

curl_easy_setopt((CURL*)pContext_, CURLOPT_HEADERFUNCTION, Request::receiveHeaderFunction);
curl_easy_setopt((CURL*)pContext_, CURLOPT_HEADERDATA, &receivedHeader_);

curl_easy_setopt((CURL*)pContext_, CURLOPT_WRITEFUNCTION, Request::receiveContentFunction);
curl_easy_setopt((CURL*)pContext_, CURLOPT_WRITEDATA, &receivedContent_);

curl_easy_setopt((CURL*)pContext_, CURLOPT_NOPROGRESS, 1);
curl_easy_setopt((CURL*)pContext_, CURLOPT_NOSIGNAL, 1);

curl_easy_setopt((CURL*)pContext_, CURLOPT_CONNECTTIMEOUT_MS, 10000);
setTimeout(10);

KBE_ASSERT(sizeof(error_) >= CURL_ERROR_SIZE);
curl_easy_setopt((CURL*)pContext_, CURLOPT_ERRORBUFFER, error_);

/* abort if slower than 30 bytes/sec during 5 seconds */
curl_easy_setopt((CURL*)pContext_, CURLOPT_LOW_SPEED_TIME, 5L);
curl_easy_setopt((CURL*)pContext_, CURLOPT_LOW_SPEED_LIMIT, 30L);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions