Post by Stephen SulzerWhat output is displayed when you run winhttptracecfg.exe ?
The following log is before I authenticated:
12:01:03.860 ::*Session* :: >>>> WinHttp Version 5.1 Build 5.1.2600
Dec 9 2003 01:37:31>>>>Process TestApplication.exe [1860 (0x744)]
started at 12:01:03.860 05/05/2004
12:01:05.152 ::*Session* :: WinHttpOpen("TestApplication", (3),
"http://my-proxy.com:8080", "", 0x0)
12:01:05.152 ::*Session* :: WinHttpOpen() returning handle 0x9b4000
12:01:05.152 ::*Session* :: WinHttpConnect(0x9b4000, "search.msn.com",
80, 0x0)
12:01:05.152 ::*Session* :: WinHttpConnect() returning handle 0x9b9000
12:01:05.152 ::*Session* :: WinHttpOpenRequest(0x9b9000, "GET",
"/results.asp?RS=CHECKED&FORM=MSNH&v=1&q=wininet", "", "", 0x0,
0x00000000)
12:01:05.152 ::*Session* :: WinHttpCreateUrlA(0x12fd78, 0x0,
0x10c0000, 0x12fdb4)
12:01:05.152 ::*Session* :: WinHttpCreateUrlA() returning TRUE
12:01:05.152 ::*0000001* :: WinHttpOpenRequest() returning handle
0x9ba000
12:01:05.152 ::*0000001* :: WinHttpSendRequest(0x9ba000, "", 0, 0x0,
0, 0, 0)
12:01:05.152 ::*0000001* :: WinHttpCreateUrlA(0x12fd38, 0x0,
0x10c0000, 0x12fd1c)
12:01:05.152 ::*0000001* :: WinHttpCreateUrlA() returning TRUE
12:01:05.152 ::*0000001* :: Using proxy server: my-proxy.com:8080
12:01:05.342 ::*0000001* :: "my-proxy.com" resolved
12:01:05.412 ::*0000001* :: sending data:
12:01:05.412 ::*0000001* :: 166 (0xa6) bytes
12:01:05.412 ::*0000001* :: <<<<-------- HTTP headers follow below
----------------------------------------------->>>>
12:01:05.412 ::*0000001* :: GET
http://search.msn.com/results.asp?RS=CHECKED&FORM=MSNH&v=1&q=wininet
HTTP/1.1
12:01:05.412 ::*0000001* :: User-Agent: TestApplication
12:01:05.412 ::*0000001* :: Host: search.msn.com
12:01:05.412 ::*0000001* :: Proxy-Connection: Keep-Alive
12:01:05.412 ::*0000001* :: <<<<-------- End
----------------------------------------------->>>>
12:01:05.412 ::*0000001* :: WinHttpSendRequest() returning TRUE
12:01:05.412 ::*0000001* :: WinHttpReceiveResponse(0x9ba000, 0x0)
12:01:05.412 ::*0000001* :: received data:
12:01:05.412 ::*0000001* :: 32 (0x20) bytes
12:01:05.412 ::*0000001* :: <<<<-------- HTTP headers follow below
----------------------------------------------->>>>
12:01:05.412 ::*0000001* :: HTTP/1.0 302 Moved Temporarily
12:01:05.412 ::*0000001* ::
12:01:05.412 ::*0000001* :: <<<<-------- End
----------------------------------------------->>>>
12:01:05.552 ::*0000001* :: sending data:
12:01:05.552 ::*0000001* :: 225 (0xe1) bytes
12:01:05.552 ::*0000001* :: <<<<-------- HTTP headers follow below
----------------------------------------------->>>>
12:01:05.552 ::*0000001* :: GET
/IssueLogin?redirect=http%3A%2F%2Fsearch.msn.com%2Fresults.asp%3FRS%3DCHECKED%26FORM%3DMSNH%26v%3D1%26q%3Dwininet
HTTP/1.1
12:01:05.552 ::*0000001* :: User-Agent: TestApplication
12:01:05.552 ::*0000001* :: Connection: Keep-Alive
12:01:05.552 ::*0000001* :: Host: my-proxy.com:8080
12:01:05.552 ::*0000001* :: <<<<-------- End
----------------------------------------------->>>>
12:01:05.572 ::*0000001* :: received data:
12:01:05.572 ::*0000001* :: 17 (0x11) bytes
12:01:05.572 ::*0000001* :: <<<<-------- HTTP headers follow below
----------------------------------------------->>>>
12:01:05.572 ::*0000001* :: HTTP/1.0 200 OK
12:01:05.572 ::*0000001* ::
12:01:05.572 ::*0000001* :: <<<<-------- End
----------------------------------------------->>>>
12:01:05.572 ::*0000001* :: WinHttpReceiveResponse() returning TRUE
12:01:06.073 ::*0000001* :: WinHttpQueryHeaders(0x9ba000, (0x16),
"<null>", 0x0, 0x12ff08 [0], 0x0 [0])
12:01:06.073 ::*0000001* :: WinHttpQueryHeaders() returning FALSE
12:01:06.073 ::*0000001* :: WinHttpQueryHeaders(0x9ba000, (0x16),
"<null>", 0xdd5b20, 0x12ff08 [358], 0x0 [0])
12:01:06.073 ::*0000001* :: WinHttpQueryHeaders() returning TRUE
12:01:06.073 ::*0000001* :: WinHttpQueryHeaders(0x9ba000,
(0x20000013), "<null>", 0x12ff4c, 0x12ff08 [4], 0x0 [0])
12:01:06.073 ::*0000001* :: WinHttpQueryHeaders() returning TRUE
12:01:06.073 ::*0000001* :: WinHttpQueryAuthSchemes(0x9ba000,
0x12ff0c, 0x12fefc)
12:01:06.073 ::*0000001* :: WinHttpQueryAuthSchemes: error 4317
[0x10dd]
12:01:06.073 ::*0000001* :: WinHttpQueryAuthSchemes() returning FALSE
12:01:06.073 ::*0000001* :: WinHttpQueryDataAvailable(0x9ba000,
0x12ff10, 0x12ff68)
12:01:06.073 ::*0000001* :: WinHttpQueryDataAvailable() returning TRUE
12:01:06.073 ::*0000001* :: WinHttpReadData(0x9ba000, 0xdd6d68, 846,
0x12ff0c)
12:01:06.073 ::*0000001* :: WinHttpReadData() returning TRUE
12:01:06.073 ::*0000001* :: WinHttpQueryDataAvailable(0x9ba000,
0x12ff10, 0x12fef4)
12:01:06.073 ::*0000001* :: WinHttpQueryDataAvailable() returning TRUE
12:01:06.073 ::*0000001* :: WinHttpReadData(0x9ba000, 0xdd7348, 3901,
0x12ff0c)
12:01:06.073 ::*0000001* :: WinHttpReadData() returning TRUE
12:01:06.093 ::*0000001* :: WinHttpQueryDataAvailable(0x9ba000,
0x12ff10, 0x12fef4)
12:01:06.093 ::*0000001* :: WinHttpQueryDataAvailable() returning TRUE
12:01:06.093 ::*0000001* :: WinHttpReadData(0x9ba000, 0xdd5b20, 0,
0x12ff0c)
12:01:06.093 ::*0000001* :: WinHttpReadData() returning TRUE
12:01:06.093 ::*0000001* :: WinHttpCloseHandle(0x9ba000)
12:01:06.093 ::*0000001* :: WinHttpCloseHandle() returning TRUE
12:01:06.093 ::*Session* :: WinHttpCloseHandle(0x9b9000)
12:01:06.093 ::*Session* :: WinHttpCloseHandle() returning TRUE
12:01:06.093 ::*Session* :: WinHttpCloseHandle(0x9b4000)
12:01:06.093 ::*Session* :: WinHttpCloseHandle() returning TRUE
The following is after I authenticated:
12:43:52.996 ::*Session* :: >>>> WinHttp Version 5.1 Build 5.1.2600
Dec 9 2003 01:37:31>>>>Process TestApplication.exe [1884 (0x75c)]
started at 12:43:52.996 05/05/2004
12:43:53.937 ::*Session* :: WinHttpOpen("TestApplication", (3),
"http://my-proxy.com:8080", "", 0x0)
12:43:53.947 ::*Session* :: WinHttpOpen() returning handle 0x9b4000
12:43:53.947 ::*Session* :: WinHttpConnect(0x9b4000, "search.msn.com",
80, 0x0)
12:43:53.947 ::*Session* :: WinHttpConnect() returning handle 0x9b9000
12:43:53.947 ::*Session* :: WinHttpOpenRequest(0x9b9000, "GET",
"/results.asp?RS=CHECKED&FORM=MSNH&v=1&q=wininet", "", "", 0x0,
0x00000000)
12:43:53.947 ::*Session* :: WinHttpCreateUrlA(0x12fd78, 0x0,
0x10c0000, 0x12fdb4)
12:43:53.947 ::*Session* :: WinHttpCreateUrlA() returning TRUE
12:43:53.947 ::*0000001* :: WinHttpOpenRequest() returning handle
0x9ba000
12:43:53.947 ::*0000001* :: WinHttpSendRequest(0x9ba000, "", 0, 0x0,
0, 0, 0)
12:43:53.947 ::*0000001* :: WinHttpCreateUrlA(0x12fd38, 0x0,
0x10c0000, 0x12fd1c)
12:43:53.947 ::*0000001* :: WinHttpCreateUrlA() returning TRUE
12:43:53.947 ::*0000001* :: Using proxy server: my-proxy.com:8080
12:43:54.127 ::*0000001* :: "my-proxy.com" resolved
12:43:54.197 ::*0000001* :: sending data:
12:43:54.197 ::*0000001* :: 166 (0xa6) bytes
12:43:54.197 ::*0000001* :: <<<<-------- HTTP headers follow below
----------------------------------------------->>>>
12:43:54.197 ::*0000001* :: GET
http://search.msn.com/results.asp?RS=CHECKED&FORM=MSNH&v=1&q=wininet
HTTP/1.1
12:43:54.197 ::*0000001* :: User-Agent: TestApplication
12:43:54.197 ::*0000001* :: Host: search.msn.com
12:43:54.197 ::*0000001* :: Proxy-Connection: Keep-Alive
12:43:54.197 ::*0000001* :: <<<<-------- End
----------------------------------------------->>>>
12:43:54.197 ::*0000001* :: WinHttpSendRequest() returning TRUE
12:43:54.197 ::*0000001* :: WinHttpReceiveResponse(0x9ba000, 0x0)
12:43:54.688 ::*0000001* :: received data:
12:43:54.688 ::*0000001* :: 17 (0x11) bytes
12:43:54.688 ::*0000001* :: <<<<-------- HTTP headers follow below
----------------------------------------------->>>>
12:43:54.688 ::*0000001* :: HTTP/1.0 200 OK
12:43:54.688 ::*0000001* ::
12:43:54.688 ::*0000001* :: <<<<-------- End
----------------------------------------------->>>>
12:43:54.698 ::*0000001* :: WinHttpReceiveResponse() returning TRUE
12:43:54.698 ::*0000001* :: WinHttpQueryHeaders(0x9ba000, (0x16),
"<null>", 0x0, 0x12ff04 [0], 0x0 [0])
12:43:54.698 ::*0000001* :: WinHttpQueryHeaders() returning FALSE
12:43:54.698 ::*0000001* :: WinHttpQueryHeaders(0x9ba000, (0x16),
"<null>", 0xdd5b20, 0x12ff04 [1662], 0x0 [0])
12:43:54.698 ::*0000001* :: WinHttpQueryHeaders() returning TRUE
12:43:55.349 ::*0000001* :: WinHttpQueryHeaders(0x9ba000,
(0x20000013), "<null>", 0x12ff4c, 0x12ff04 [4], 0x0 [0])
12:43:55.349 ::*0000001* :: WinHttpQueryHeaders() returning TRUE
12:43:55.349 ::*0000001* :: WinHttpQueryAuthSchemes(0x9ba000,
0x12ff0c, 0x12fefc)
12:43:55.349 ::*0000001* :: WinHttpQueryAuthSchemes: error 4317
[0x10dd]
12:43:55.349 ::*0000001* :: WinHttpQueryAuthSchemes() returning FALSE
12:43:55.349 ::*0000001* :: WinHttpQueryDataAvailable(0x9ba000,
0x12ff10, 0x12ff68)
12:43:55.349 ::*0000001* :: WinHttpQueryDataAvailable() returning TRUE
12:43:55.349 ::*0000001* :: WinHttpReadData(0x9ba000, 0xdd5b20, 194,
0x12ff0c)
12:43:55.349 ::*0000001* :: WinHttpReadData() returning TRUE
12:43:55.349 ::*0000001* :: WinHttpQueryDataAvailable(0x9ba000,
0x12ff10, 0x12fef4)
12:43:55.349 ::*0000001* :: WinHttpQueryDataAvailable() returning TRUE
12:43:55.349 ::*0000001* :: WinHttpReadData(0x9ba000, 0xdd7288, 7998,
0x12ff0c)
12:43:55.349 ::*0000001* :: WinHttpReadData() returning TRUE
12:43:55.600 ::*0000001* :: WinHttpQueryDataAvailable(0x9ba000,
0x12ff10, 0x12fef4)
12:43:55.610 ::*0000001* :: WinHttpQueryDataAvailable() returning TRUE
12:43:55.610 ::*0000001* :: WinHttpReadData(0x9ba000, 0xdd7288, 5196,
0x12ff0c)
12:43:55.610 ::*0000001* :: WinHttpReadData() returning TRUE
12:43:55.770 ::*0000001* :: WinHttpQueryDataAvailable(0x9ba000,
0x12ff10, 0x12fef4)
12:43:55.770 ::*0000001* :: WinHttpQueryDataAvailable() returning TRUE
12:43:55.770 ::*0000001* :: WinHttpReadData(0x9ba000, 0xdd7288, 3032,
0x12ff0c)
12:43:55.770 ::*0000001* :: WinHttpReadData() returning TRUE
12:43:55.870 ::*0000001* :: WinHttpQueryDataAvailable(0x9ba000,
0x12ff10, 0x12fef4)
12:43:55.870 ::*0000001* :: WinHttpQueryDataAvailable() returning TRUE
12:43:55.870 ::*0000001* :: WinHttpReadData(0x9ba000, 0xdd5b20, 0,
0x12ff0c)
12:43:55.870 ::*0000001* :: WinHttpReadData() returning TRUE
12:43:55.870 ::*0000001* :: WinHttpCloseHandle(0x9ba000)
12:43:55.870 ::*0000001* :: WinHttpCloseHandle() returning TRUE
12:43:55.870 ::*Session* :: WinHttpCloseHandle(0x9b9000)
12:43:55.870 ::*Session* :: WinHttpCloseHandle() returning TRUE
12:43:56.972 ::*Session* :: WinHttpCloseHandle(0x9b4000)
12:43:56.972 ::*Session* :: WinHttpCloseHandle() returning TRUE
Post by Stephen SulzerA couple
1. the trace file may not be available on disk until your program or
service that uses WinHTTP shuts down. WinHTTP flushes the trace file to disk
when winhttp.dll is unloaded from memory.
2. the 'FileNamePrefix' option does not specify the full trace file
name. If the FileNamePrefix is set to "c:\test\winhttplog", for example,
then the trace file will be located in the c:\test directory and the file
name will be "winhttplog-<process-name>.<time>.LOG".
3. WinHTTP picks up the trace settings when winhttp.dll is first loaded
into the process. So ensure that the trace configuration is set before you
start your service or program that uses WinHTTP.
This didn't start working for me until I allowed the program to run to
completion once. I was running my TestApplication in the debugger
expecting a log file to appear and it never did so I would stop the
debugger and it would still not appear. Then, when I allowed the
program to run to completion once, all of my other loggings have
occurred (even when I stop the application in the debugger prior to
program completion).
Post by Stephen SulzerIs the proxy server that you specify in the WinHttpOpen call the same proxy
that you preauthenticate with?
Yes, it is.
Post by Stephen SulzerI don't understand how preauthenticating with the proxy server works. I'm
not sure how your proxy would remember that your client is authenticated.
What kind of proxy server are you using and do you know what kind of
authentication protocol it uses (e.g., Digest, Basic, NTLM)? WinHTTP
supports only HTTP web proxies, and only Basic, Digest, NTLM/Kerberos
(Integrated Windows Authentication) and Passport authentication schemes.
WinHTTP does not support SOCKS proxies.
I tried doing a WinHttpQueryAuthSchemes in an attempt to retrieve the
authentication means without any success. I have also tried using
WinHttpSetCredentials with every type of authentication scheme listed
in the documentation without any success.
Post by Stephen SulzerWhat are the response headers in the case where you haven't authenticated?
See logs above.
Thanks,
dg