Chris Shearer Cooper
2005-10-09 22:39:36 UTC
I'm trying to read a file over HTTPS asynchronously, and all is working fine
until the call to InternetReadFileEx.
I call InternetOpen, then InternetConnect (checking for async return), then
HttpOpenRequest (checking for async return), then HttpSendRequestEx
(checking for async return), and on some of those I do see the async stuff
happening (function returns ERROR_IO_PENDING, I wait for the callback to get
called, etc.) so I have faith that I have that part working.
So that's all good, and then I call InternetReadFileEx to get the actual
data. It's returning 12019 (ERROR_INTERNET_INCORRECT_HANDLE_STATE).
The INTERNET_BUFFERS struct I'm passing in to InternetReadFileEx is first
zeroed, then I set the dwStructSize, then the lpvBuffer and dwBufferLength.
I've seen the msdn kb stuff about this error, but (1) they talk about
problems with InternetWriteFile, and (2) the flags I'm passing to
HttpOpenRequest include INTERNET_FLAG_NO_CACHE_WRITE (which is what msdn
says fixes this) - the flags are
INTERNET_FLAG_RELOAD|INTERNET_FLAG_KEEP_CONNECTION|INTERNET_FLAG_NO_CACHE_WRITE|
INTERNET_FLAG_SECURE|INTERNET_FLAG_IGNORE_CERT_CN_INVALID
Any suggestions?? I saw this same issue over on codeproject.com (in the
discussion at the bottom of
http://www.codeproject.com/internet/asyncwininet.asp) but there wasn't a
good description of the solution.
Thanks all!
Chris
until the call to InternetReadFileEx.
I call InternetOpen, then InternetConnect (checking for async return), then
HttpOpenRequest (checking for async return), then HttpSendRequestEx
(checking for async return), and on some of those I do see the async stuff
happening (function returns ERROR_IO_PENDING, I wait for the callback to get
called, etc.) so I have faith that I have that part working.
So that's all good, and then I call InternetReadFileEx to get the actual
data. It's returning 12019 (ERROR_INTERNET_INCORRECT_HANDLE_STATE).
The INTERNET_BUFFERS struct I'm passing in to InternetReadFileEx is first
zeroed, then I set the dwStructSize, then the lpvBuffer and dwBufferLength.
I've seen the msdn kb stuff about this error, but (1) they talk about
problems with InternetWriteFile, and (2) the flags I'm passing to
HttpOpenRequest include INTERNET_FLAG_NO_CACHE_WRITE (which is what msdn
says fixes this) - the flags are
INTERNET_FLAG_RELOAD|INTERNET_FLAG_KEEP_CONNECTION|INTERNET_FLAG_NO_CACHE_WRITE|
INTERNET_FLAG_SECURE|INTERNET_FLAG_IGNORE_CERT_CN_INVALID
Any suggestions?? I saw this same issue over on codeproject.com (in the
discussion at the bottom of
http://www.codeproject.com/internet/asyncwininet.asp) but there wasn't a
good description of the solution.
Thanks all!
Chris