此处描述的 WinHTTP 身份验证:http:
//msdn.microsoft.com/en-us/library/windows/desktop/aa383144 (v=vs.85).aspx
如果我"Transfer-Encoding: Chunked\r\n"
在调用WinHttpSendRequest()
. 如果这样做,我将无法登录,因为WinHttpReceiveResponse()
在使用 设置凭据WinHttpSetCredentials()
并再次使用 重新发送请求后失败WinHttpSendRequest()
。由于我真的需要分块传输,是否可以将它与 Windows 身份验证结合使用?
以下是使用分块编码时审核失败的日志:
SubjectUserSid S-1-5-18
SubjectUserName MY-PC-NAME$
SubjectDomainName WORKGROUP
SubjectLogonId 0x3e7
TargetUserSid S-1-0-0
TargetUserName Administrator
TargetDomainName MY-PC-NAME
Status 0xc000006d
FailureReason %%2313
SubStatus 0xc000006a
LogonType 2
LogonProcessName User32
AuthenticationPackageName Negotiate
WorkstationName MY-PC-NAME
TransmittedServices -
LmPackageName -
KeyLength 0
ProcessId 0x1d8
ProcessName C:\Windows\System32\winlogon.exe
IpAddress 127.0.0.1
IpPort 0
而且,这是没有分块编码的成功审计:
SubjectUserSid S-1-0-0
SubjectUserName -
SubjectDomainName -
SubjectLogonId 0x0
TargetUserSid S-1-5-21-4112068699-3954607238-3758397191-1005
TargetUserName moose
TargetDomainName MY-PC-NAME
TargetLogonId 0x137576fb8
LogonType 3
LogonProcessName NtLmSsp
AuthenticationPackageName NTLM
WorkstationName M_10
LogonGuid {00000000-0000-0000-0000-000000000000}
TransmittedServices -
LmPackageName NTLM V2
KeyLength 128
ProcessId 0x0
ProcessName -
IpAddress 167.109.28.37
IpPort 56695
正如你所看到的,有很多东西是不同的:域、用户名、IP、端口、登录类型、TargetUserSid 等等……而且都是因为"Transfer-Encoding: Chunked\r\n"
!?
编辑:
为了简单起见,问题是:
success = WinHttpSetCredentials( hPostRequest, target, authScheme, IIS_USER_NAME, IIS_PWD, NULL );
success = WinHttpSendRequest( hPostRequest,
L"Transfer-Encoding: Chunked\r\n",
(DWORD)-1,
WINHTTP_NO_REQUEST_DATA,
0,
WINHTTP_IGNORE_REQUEST_TOTAL_LENGTH,
0 );
成功返回值后,接下来调用什么 WinHttp API?