Function at 0x513550
Capabilities:
Check for time delay via gettickcount
Check http status code

Disassembly:
sub esp, 0x38
push ebx
push ebp
push esi
push edi
mov edi, dword [esp + 0x4c]
mov ebp, dword [edi]
xor ebx, ebx
mov dword [esp + 0x3c], ebx
mov eax, dword [ebp + 0x19c]
cmp eax, ebx
mov dword [esp + 0x2c], eax
jne 0x513579
mov dword [esp + 0x2c], 0x36ee80
mov eax, dword [esp + 0x50]
mov ecx, dword [edi + eax*4 + 0x130]
mov dword [esp + 0x30], ecx
mov dword [esp + 0x40], ebx
mov dword [esp + 0x44], ebx
mov dword [esp + 0x28], ebx
mov dword [esp + 0x38], ebx
mov dword [esp + 0x24], ebx
mov dword [edi + 0x1f4], ebx
cmp dword [edi + 0x1d0], ebx
jne 0x513797
movzx esi, word [esp + 0x58]
mov edx, dword [esp + 0x54]
push esi
push edx
push str.Establish_HTTP_proxy_tunnel_to__s:_hu_n
push ebp
call fcn.004f87e0
mov eax, dword [ebp + 0xd4]
add esp, 0x10
cmp eax, ebx
je 0x5135e0
push eax
call fcn.004d01b5
add esp, 4
mov dword [ebp + 0xd4], ebx
call fcn.0050aec0
mov ebx, eax
test ebx, ebx
je 0x513cfc
mov eax, dword [esp + 0x54]
push esi
push eax
push str._s:_hu
call fcn.004facb0
add esp, 0xc
test eax, eax
mov dword [esp + 0x20], eax
je 0x513cf3
push 1
push eax
push str.CONNECT
push edi
call fcn.0050aaf0
mov esi, eax
add esp, 0x10
test esi, esi
jne 0x513763
mov ecx, dword [esp + 0x4c]
cmp dword [ecx + 0x114], 1
mov esi, 0x575348
mov edi, esi
mov dword [esp + 0x18], esi
mov dword [esp + 0x14], 0x565500
je 0x513651
mov dword [esp + 0x14], 0x565504
push str.Host:
push ebp
call fcn.0050a5b0
add esp, 8
test eax, eax
jne 0x51367f
mov edx, dword [esp + 0x20]
push edx
push str.Host:__s_r_n
call fcn.004facb0
mov edi, eax
add esp, 8
test edi, edi
je 0x513d09
push str.Proxy_Connection:
push ebp
call fcn.0050a5b0
add esp, 8
test eax, eax
jne 0x513699
mov dword [esp + 0x18], str.Proxy_Connection:_Keep_Alive_r_n
push str.User_Agent:
push ebp
call fcn.0050a5b0
add esp, 8
test eax, eax
jne 0x5136bd
cmp dword [ebp + 0x3a0], eax
je 0x5136bd
mov eax, dword [esp + 0x4c]
mov esi, dword [eax + 0x228]
mov ecx, dword [esp + 0x4c]
mov eax, dword [ecx + 0x224]
test eax, eax
jne 0x5136d0
mov eax, 0x575348
mov edx, dword [esp + 0x18]
mov ecx, dword [esp + 0x54]
push edx
push esi
push eax
mov eax, dword [esp + 0x20]
push edi
push eax
movzx eax, word [esp + 0x6c]
push eax
push ecx
push str.CONNECT__s:_hu_HTTP__s_r_n_s_s_s_s
push ebx
call fcn.0050b760
add esp, 0x24
test edi, edi
mov esi, eax
je 0x51370a
cmp byte [edi], 0
je 0x51370a
push edi
call fcn.004d01b5
add esp, 4
test esi, esi
jne 0x51374f
mov edi, dword [esp + 0x4c]
push ebx
push edi
call fcn.0050b840
mov esi, eax
add esp, 8
test esi, esi
jne 0x51374f
push 0x55d274
push ebx
call fcn.0050b760
mov esi, eax
add esp, 8
test esi, esi
jne 0x51374f
mov edx, dword [esp + 0x50]
push edx
push eax
lea eax, [ebp + 0x86a4]
push eax
push edi
push ebx
call fcn.0050aed0
add esp, 0x14
mov esi, eax
xor ebx, ebx
test esi, esi
je 0x513763
push str.Failed_sending_CONNECT_to_proxy
push ebp
call fcn.004f8870
add esp, 8
mov ecx, dword [esp + 0x20]
push ecx
call fcn.004d01b5
add esp, 4
test ebx, ebx
je 0x51377d
push ebx
call fcn.004d01b5
add esp, 4
test esi, esi
jne 0x513d29
mov edx, dword [esp + 0x4c]
mov dword [edx + 0x1d0], 1
mov edi, edx
xor ebx, ebx
mov eax, dword [edi + 0x124]
mov ecx, dword [edi + 0x120]
push eax
push ecx
call fcn.004fd5c0
push edx
push eax
call fcn.004fd5f0
mov edx, dword [esp + 0x3c]
sub edx, eax
add esp, 0x10
test edx, edx
jle 0x513d33
cmp dword [ebp + 0x520], 2
jne 0x5137e3
mov eax, dword [esp + 0x30]
push ebx
push 0xffffffffffffffff
push eax
call fcn.0050e1c0
add esp, 0xc
test eax, eax
je 0x513dfa
xor ebx, ebx
lea eax, [ebp + 0x53c]
mov dword [edi + 0x1d0], ebx
mov dword [esp + 0x18], eax
mov esi, eax
mov dword [esp + 0x20], ebx
mov dword [esp + 0x14], ebx
mov dword [esp + 0x10], 1
jmp 0x513810
cmp dword [esp + 0x10], 0
je 0x513c93
cmp dword [esp + 0x24], 0
jne 0x513d41
mov ecx, dword [edi + 0x124]
mov edx, dword [edi + 0x120]
push ecx
push edx
call fcn.004fd5c0
push edx
push eax
call fcn.004fd5f0
mov ecx, dword [esp + 0x3c]
sub ecx, eax
add esp, 0x10
test ecx, ecx
jle 0x513d33
cmp ecx, 0x3e8
jl 0x51385e
mov ecx, 0x3e8
mov eax, dword [esp + 0x30]
push ecx
push 0xffffffffffffffff
push eax
call fcn.0050e1c0
add esp, 0xc
cmp eax, 0xffffffff
je 0x513c5c
test eax, eax
je 0x513c72
mov eax, dword [esp + 0x18]
lea ecx, [esp + 0x1c]
push ecx
mov ecx, dword [esp + 0x34]
mov edx, 0x4000
sub edx, ebx
push edx
push eax
push ecx
push edi
call fcn.004f8550
add esp, 0x14
cmp eax, 0x51
je 0x513c87
xor ecx, ecx
cmp eax, ecx
je 0x5138b7
mov dword [esp + 0x10], ecx
jmp 0x513c72
mov eax, dword [esp + 0x1c]
cmp eax, ecx
jg 0x5138ec
cmp dword [ebp + 0x118], ecx
mov dword [esp + 0x10], ecx
je 0x5138e2
cmp dword [ebp + 0x85dc], ecx
je 0x5138e2
mov dword [edi + 0x1f4], 1
jmp 0x513c72
push str.Proxy_CONNECT_aborted
jmp 0x513c61
add ebx, eax
cmp dword [esp + 0x10], 1
mov dword [esp + 0x20], ebx
jle 0x51398d
mov edx, dword [esp + 0x40]
or edx, dword [esp + 0x44]
mov dword [esp + 0x20], ecx
lea ecx, [ebp + 0x53c]
mov dword [esp + 0x18], ecx
je 0x513946
cdq
sub dword [esp + 0x40], eax
mov eax, dword [esp + 0x44]
sbb eax, edx
test eax, eax
mov dword [esp + 0x44], eax
jg 0x513c72
jl 0x513939
cmp dword [esp + 0x40], 0
ja 0x513c72
mov dword [esp + 0x10], 0
jmp 0x513c72
lea edx, [esp + 0x34]
push edx
push eax
push ecx
xor ebx, ebx
push edi
mov dword [esp + 0x44], ebx
call fcn.00511170
add esp, 0x10
cmp eax, 0xffffffff
jne 0x513975
push str.chunk_reading_DONE_n
push ebp
call fcn.004f87e0
mov dword [esp + 0x18], ebx
jmp 0x513c6f
mov eax, dword [esp + 0x34]
push eax
push str.Read__zd_bytes_of_chunk__continue_n
push ebp
call fcn.004f87e0
add esp, 0xc
jmp 0x513c72
xor ebx, ebx
test eax, eax
mov dword [esp + 0x34], ebx
jle 0x513c72
mov ecx, 1
mov edx, dword [esp + 0x18]
add dword [esp + 0x14], ecx
cmp byte [edx], 0xa
jne 0x513b67
cmp dword [ebp + 0x2e4], 0
je 0x5139cc
mov eax, dword [esp + 0x14]
push edi
push eax
push esi
push 1
push ebp
call fcn.004f86f0
add esp, 0x14
cmp dword [ebp + 0x2c8], 0
mov eax, 2
je 0x5139df
mov eax, 3
mov ecx, dword [esp + 0x14]
push ecx
push esi
push eax
push edi
call fcn.004f8b50
add esp, 0x10
test eax, eax
jne 0x513dfc
mov al, byte [esi]
cmp al, 0xd
je 0x513b7e
cmp al, 0xa
je 0x513b7e
mov eax, dword [esp + 0x14]
mov bl, byte [eax + esi]
push 0x11
push esi
push str.WWW_Authenticate:
mov byte [eax + esi], 0
call fcn.00510060
add esp, 0xc
test eax, eax
je 0x513a35
mov eax, dword [ebp + 0x90]
cmp eax, 0x191
je 0x513a56
push 0x13
push esi
push str.Proxy_authenticate:
call fcn.00510060
add esp, 0xc
test eax, eax
je 0x513a6e
mov eax, dword [ebp + 0x90]
cmp eax, 0x197
jne 0x513a6e
push esi
push eax
push edi
call fcn.0050ac00
add esp, 0xc
test eax, eax
jne 0x513dfc
jmp 0x513b40
push 0xf
push esi
push str.Content_Length:
call fcn.00510060
add esp, 0xc
test eax, eax
je 0x513a9f
push 0xa
lea edx, [esi + 0xf]
push 0
push edx
call fcn.004dbaa1
add esp, 0xc
mov dword [esp + 0x40], eax
mov dword [esp + 0x44], edx
jmp 0x513b40
push str.close
push str.Connection:
push esi
call fcn.0050b160
add esp, 0xc
test eax, eax
je 0x513ac3
mov dword [esp + 0x28], 1
jmp 0x513b40
push str.chunked
push str.Transfer_Encoding:
push esi
call fcn.0050b160
add esp, 0xc
test eax, eax
je 0x513af8
push str.CONNECT_responded_chunked_n
push ebp
call fcn.004f87e0
push edi
mov dword [esp + 0x44], 1
call fcn.00511150
add esp, 0xc
jmp 0x513b40
push str.close
push str.Proxy_Connection:
push esi
call fcn.0050b160
add esp, 0xc
test eax, eax
je 0x513b19
mov dword [esp + 0x28], 1
jmp 0x513b40
lea edi, [ebp + 0x90]
push edi
lea eax, [esp + 0x40]
push eax
push str.HTTP_1._d__d
push esi
call fcn.004cdbac
add esp, 0x10
cmp eax, 2
jne 0x513b40
mov ecx, dword [edi]
mov dword [ebp + 0x8690], ecx
mov edx, dword [esp + 0x14]
mov eax, dword [esp + 0x18]
mov edi, dword [esp + 0x4c]
mov byte [edx + esi], bl
mov ebx, dword [esp + 0x34]
lea esi, [eax + 1]
mov eax, dword [esp + 0x1c]
mov dword [esp + 0x14], 0
mov ecx, 1
add dword [esp + 0x18], ecx
add ebx, ecx
cmp ebx, eax
mov dword [esp + 0x34], ebx
jl 0x5139a0
jmp 0x513c72
xor ecx, ecx
cmp dword [ebp + 0x90], 0x197
lea eax, [ebp + 0x53c]
mov dword [esp + 0x20], ecx
mov dword [esp + 0x18], eax
jne 0x5138ae
cmp dword [ebp + 0x85ec], ecx
jne 0x5138ae
mov edx, dword [esp + 0x40]
or edx, dword [esp + 0x44]
mov dword [esp + 0x10], 2
je 0x513bdf
mov eax, dword [esp + 0x44]
mov ecx, dword [esp + 0x40]
push eax
push ecx
push str.Ignore__lld_bytes_of_response_body_n
push ebp
call fcn.004f87e0
mov eax, dword [esp + 0x2c]
add esp, 0x10
sub eax, ebx
jmp 0x513915
cmp dword [esp + 0x38], ecx
je 0x5138ae
mov edx, dword [esp + 0x1c]
sub edx, ebx
push edx
push str._zd_bytes_of_chunk_left_n
push ebp
mov dword [ebp + 0xc8], 1
call fcn.004f87e0
add esp, 0xc
cmp byte [esi + 1], 0xa
jne 0x513c14
add esi, 1
add ebx, 1
mov ecx, dword [esp + 0x1c]
lea eax, [esp + 0x1c]
push eax
sub ecx, ebx
push ecx
lea edx, [esi + 1]
push edx
push edi
call fcn.00511170
add esp, 0x10
cmp eax, 0xffffffff
jne 0x513c47
push str.chunk_reading_DONE_n
push ebp
call fcn.004f87e0
mov dword [esp + 0x18], 0
jmp 0x513c6f
mov eax, dword [esp + 0x1c]
push eax
push str.Read__zd_bytes_of_chunk__continue_n
push ebp
call fcn.004f87e0
add esp, 0xc
jmp 0x513c72
push str.Proxy_CONNECT_aborted_due_to_select_poll_error
push ebp
mov dword [esp + 0x2c], 1
call fcn.004f8870
add esp, 8
push edi
call fcn.0050f800
add esp, 4
test eax, eax
jne 0x513d4e
mov ebx, dword [esp + 0x20]
cmp ebx, 0x4000
jb 0x513810
cmp dword [esp + 0x24], 0
jne 0x513d41
cmp dword [ebp + 0x8690], 0xc8
je 0x513cce
push edi
call fcn.0050b590
add esp, 4
test eax, eax
jne 0x513dfc
cmp dword [edi + 0x198], eax
je 0x513cce
mov esi, 1
mov dword [esp + 0x28], esi
jmp 0x513cd6
mov esi, dword [esp + 0x28]
test esi, esi
je 0x513cdf
cmp dword [ebp + 0xd4], 0
jne 0x513d5b
cmp dword [ebp + 0xd4], 0
je 0x513d7b
xor ebx, ebx
jmp 0x5135a2
push ebx
call fcn.004d01b5
add esp, 4
pop edi
pop esi
pop ebp
mov eax, 0x1b
pop ebx
add esp, 0x38
ret
push ebx
call fcn.004d01b5
mov ecx, dword [esp + 0x24]
push ecx
call fcn.004d01b5
add esp, 8
pop edi
pop esi
pop ebp
mov eax, 0x1b
pop ebx
add esp, 0x38
ret
pop edi
mov eax, esi
pop esi
pop ebp
pop ebx
add esp, 0x38
ret
push str.Proxy_CONNECT_aborted_due_to_timeout
push ebp
call fcn.004f8870
add esp, 8
pop edi
pop esi
pop ebp
mov eax, 0x38
pop ebx
add esp, 0x38
ret
pop edi
pop esi
pop ebp
mov eax, 0x2a
pop ebx
add esp, 0x38
ret
mov ebx, dword [esp + 0x50]
mov edx, dword [edi + ebx*4 + 0x130]
push edx
push edi
call fcn.004f94c0
add esp, 8
mov dword [edi + ebx*4 + 0x130], 0xffffffff
mov eax, dword [ebp + 0x90]
cmp eax, 0xc8
je 0x513dbb
push eax
push str.Received_HTTP_code__d_from_proxy_after_CONNECT
push ebp
call fcn.004f8870
add esp, 0xc
test esi, esi
je 0x513dae
cmp dword [ebp + 0xd4], 0
je 0x513dae
mov dword [edi + 0x1f4], 1
pop edi
pop esi
pop ebp
mov eax, 0x38
pop ebx
add esp, 0x38
ret
mov eax, dword [edi + 0x224]
xor esi, esi
cmp eax, esi
je 0x513dd6
push eax
call fcn.004d01b5
add esp, 4
mov dword [edi + 0x224], esi
push str.Proxy_replied_OK_to_CONNECT_request_n
mov dword [edi + 0x224], esi
push ebp
mov dword [ebp + 0x85e0], 1
call fcn.004f87e0
add esp, 8
mov dword [ebp + 0xc8], esi
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x38
ret