MCPcopy Create free account
hub / github.com/defold/defold / New

Function New

engine/dlib/src/dlib/http_client.cpp:286–325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284 }
285
286 HClient New(const NewParams* params, const dmURI::Parts* hostURI, int* cancelflag, dmURI::Parts* proxyURI)
287 {
288 dmSocket::Address address;
289 if (dmSocket::GetHostByNameT(hostURI->m_Hostname, &address, params->m_RequestTimeout, cancelflag) != dmSocket::RESULT_OK)
290 {
291 return 0;
292 }
293
294 Client* client = new Client();
295
296 client->m_SocketResult = dmSocket::RESULT_OK;
297
298 client->m_Userdata = params->m_Userdata;
299 client->m_HttpContent = params->m_HttpContent;
300 client->m_HttpHeader = params->m_HttpHeader;
301 client->m_HttpSendContentLength = params->m_HttpSendContentLength;
302 client->m_HttpWrite = params->m_HttpWrite;
303 client->m_HttpWriteHeaders = params->m_HttpWriteHeaders;
304 client->m_MaxGetRetries = params->m_MaxGetRetries;
305 client->m_RequestTimeout = params->m_RequestTimeout;
306 client->m_RequestStart = 0;
307 client->m_Secure = (strcmp(hostURI->m_Scheme, "https") == 0) || (strcmp(hostURI->m_Scheme, "wss") == 0);
308 client->m_CancelFlag = cancelflag;
309
310#if defined(DM_NO_HTTP_CACHE)
311 client->m_HttpCache = 0;
312 client->m_IgnoreCache = 1;
313#else
314 client->m_HttpCache = params->m_HttpCache;
315 client->m_IgnoreCache = params->m_HttpCache != 0 ? 0 : 1;
316#endif
317
318 memcpy(&client->m_HostURI, hostURI, sizeof(*hostURI));
319 if (proxyURI)
320 {
321 memcpy(&client->m_ProxyURI, proxyURI, sizeof(*proxyURI));
322 }
323
324 return client;
325 }
326
327 HClient New(const NewParams* params, const dmURI::Parts* hostURI, int* cancelflag)
328 {

Callers 2

PoolCreatorMethod · 0.70
GetPoolMethod · 0.70

Calls 1

GetHostByNameTFunction · 0.85

Tested by

no test coverage detected