1) Change the timeout. However there is known bug in some versions of
WinInet that means that this doesn't always work. The recommended
workaround is to use async mode, which brings us to...
2) Use async mode. Unfortunately I cannot get HttpSendRequestEx() to
work in async mode at all! (InternetOpenUrl() works fine but isn't rich
enough for my needs). HttpSendRequestEx() used on a handle that was
opened in async mode (inherrited from one returned from InternetOpen()
with the ASYNC flag) always returns ERROR_IO_PENDING (and doesn't kick
off a send - the callback is not called and a socket-level trace shows
no acivity). This is similar to another known bug with async use of one
of the FTP functions, the recommended workaround to which is...
3) Use another thread to monitor elapsed time and terminate the first
request on the original thread using InternetCloseHandle() when it
decides it should be timed out. In none-problem states this seems to
work fine, but in my original problem state closing the handle does NOT
unblock the original HttpSendRequest() call! This eventually returns
after 10 minutes but the closing of its handle doesn't expedite this!!!
At this point I'm out of options and ideas. If anyone has seen this
behaviour and has any ideas/workarounds please let me know (I'd
appreciate an email if possible - steve_...@iora.com)
"Steve Draper" <steve_...@iora.com> wrote in message
news:38F675F48B36D4118E4D...@cpmsftmsgv21.microsoft.com...
Also, I learned that sendrequest will hang if you accidentally use the wrong
port number. Such as accidentally using the SSL port 443 for a regular
request that should have been on port 80.
Does HttpSendRequestEx have to be followed by HttpEndRequest to
actually send the request? Is InternetWriteFile necessary?
What should the 4th parameter of HttpSendRequestEx be in asynchronous
mode?
My callback function receives INTERNET_STATUS_REQUEST_COMPLETE before
INTERNET_STATUS_REQUEST_SENT or INTERNET_STATUS_REQUEST_RECEIVED, any
suggestions why?
Sorry for all the questions, this has been much trouble for me.
thanks,
Darren
> GetLastError(). If it is ERROR_IO_PENDING then everything is ok and
you
> have to wait until that "process" ends: assign Event,
> Event.WaitFor(INFINITE). And in Callback function Set Event.
> Got it?
> Anatoliy Savchak
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
Steve,
I have been attempting to issue asynchronous https Wininet requests for
the last week with inconsistent success. Which handle are you passing
to InternetSetStatusCallback? Are you specifying your callback
function's context value as the last parameter to the InternetConnect
and HttpOpenRequest functions? I have found that synchronizing your
main thread with the callback function works well with CreateEvent,
ResetEvent, WaitForSingleObject, and SetEvent.
hope this helps,
Darren
>Is InternetWriteFile necessary?
No, unless you actually want to send data.
> What should the 4th parameter of HttpSendRequestEx be in asynchronous
> mode?
HSR_ASYNC
> My callback function receives INTERNET_STATUS_REQUEST_COMPLETE before
> INTERNET_STATUS_REQUEST_SENT or INTERNET_STATUS_REQUEST_RECEIVED,
> any suggestions why?
There is no INTERNET_STATUS_REQUEST_RECEIVED. Do you mean
INTERNET_STATUS_RESPONSE_RECEIVED? Anyway, I don't know why.
Alexandre de Menezes.
Actually, I've now implemented this successfully without calling
InternetWriteFile. I fill the INTERNET_BUFFERS structure with my data
and pass it to HttpSendRequestEx.
>
> > What should the 4th parameter of HttpSendRequestEx be in
asynchronous
> > mode?
> HSR_ASYNC
>
> > My callback function receives INTERNET_STATUS_REQUEST_COMPLETE
before
> > INTERNET_STATUS_REQUEST_SENT or INTERNET_STATUS_REQUEST_RECEIVED,
> > any suggestions why?
> There is no INTERNET_STATUS_REQUEST_RECEIVED. Do you mean
> INTERNET_STATUS_RESPONSE_RECEIVED?
Yes, sorry my fault.
Anyway, I don't know why.
>
> Alexandre de Menezes.
>
>
Your help is very much appreciated Alexandre.
Darren Eisenzimmer