MCPcopy Create free account
hub / github.com/aixed/WeChat-Hook / HttpPostThread_

Function HttpPostThread_

src/http_post.cpp:276–370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274
275
276static DWORD WINAPI HttpPostThread_(LPVOID lp)
277{
278 HttpPostTask* task = (HttpPostTask*)lp;
279 if (!task)
280 return 0;
281
282 URL_COMPONENTSW uc{};
283 uc.dwStructSize = sizeof(uc);
284
285 wchar_t host[256] = { 0 };
286 wchar_t path[1024] = { 0 };
287
288 uc.lpszHostName = host;
289 uc.dwHostNameLength = _countof(host);
290 uc.lpszUrlPath = path;
291 uc.dwUrlPathLength = _countof(path);
292
293 if (!WinHttpCrackUrl(
294 task->url.c_str(),
295 0,
296 0,
297 &uc))
298 {
299 delete task;
300 return 0;
301 }
302
303 HINTERNET hSession = WinHttpOpen(
304 L"HTTP/1.0",
305 WINHTTP_ACCESS_TYPE_NO_PROXY,
306 WINHTTP_NO_PROXY_NAME,
307 WINHTTP_NO_PROXY_BYPASS,
308 0
309 );
310 if (!hSession)
311 {
312 delete task;
313 return 0;
314 }
315
316 HINTERNET hConnect = WinHttpConnect(
317 hSession,
318 uc.lpszHostName,
319 uc.nPort,
320 0
321 );
322 if (!hConnect)
323 {
324 WinHttpCloseHandle(hSession);
325 delete task;
326 return 0;
327 }
328
329 DWORD flags = (uc.nScheme == INTERNET_SCHEME_HTTPS)
330 ? WINHTTP_FLAG_SECURE
331 : 0;
332
333 HINTERNET hRequest = WinHttpOpenRequest(

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected