I'm trying to access an HTTP server using Digest authentication and WinINet
API (Windows XP Pro SP3). The sequence of WinINet calls is:
...
- InternetConnect. Setting the proper username and password.
- HttpOpenRequest
- HttpSendRequest
...
Running a sample application on a normal user account, the behavior of a
single call to HttpSendRequest is the following (Behavior 1):
- The application sends an HTTP GET command without authorization header or
info.
- The server replies with a 401 and the authorization scheme requiered,
digest in this case.
- The application sends a new GET command with the correct digest
authorization.
- The HttpSendRequest call finishes
- The server replies with the document requested.
This is the desired behavior.
The problem is, when the application is run on the local system account
(creating a windows service or using the "at" command), the bahavior of
HttpSendRequest changes and doesn't send the second GET command (Behavior 2):
- The application sends an HTTP GET command without authorization header or
info.
- The server replies with a 401 and the authorization scheme requiered,
digest in this case.
- The HttpSendRequest call finishes.
I've done some tests using different configurations and the results are:
- Sample application, user account -> behavior 1
- Sample application, local system account (at command) -> behavior 2
- Windows service, local system account -> behavior 2
- Windows service, user account -> behavior 1
Using basic authentication, both the application and the service work OK
with behavior 1 on both user's and local system accounts.
I need to access this server with this authentication scheme from a Windows
service running on the local system account. Does anybody know why the
behavior of HttpSendRequest differs from one account to the other?
Thanks!