views:

44

answers:

1

I see that WinHTTP is not reentrant (1,2). Is WinINET reentrant?

We have an ActiveX control that does synchronous HTTP with WinINET. If the browser (in javascript) fires an asynchronous http request (ajax) and then immediately calls the ActiveX operation (same IE process), it seems like the two operations are interleaving, perhaps reentrant on the same API, and breaking the WinINET state: clearInterval on the ajax incorrectly fails once. We're using EXT for ajax and EXT assumes clearInterval works the first time.

+2  A: 

An important restriction of Windows Internet (WinINet) API is that WinINet should be not used in a service (only in GUI app.) because of possible dialogs, Windows HTTP Services (WinHTTP) has not the restriction. It is designed for service application has improved support of asynchronous requests. In my information WinHTTP is reenterant. If you have a reference which say other please post it.

The usage of WinINET in a COM application can do have some effects. In Different Handling of Asynchronous Requests are described some differences how WinINet and WinHTTP asynchronous and synchronously requests.

The last change in WinINET was for Windows XP and Windows Server 2003 R2. WinHTTP has some new features in Windows Server 2008 and Windows Vista.

If the part of your application is not large enough and use only HTTP/HTTPS I would you recommend to to port it from WinINet Applications to WinHTTP. If you do want or have to stay with WinINET you can post in your question an example how you use WinINet in your application. Probably changing of the code can solve your multi-threaded problems.

Oleg
thx, still digesting your response. i added references wrt WinHTTP reentrancy
Dustin Getz
@Dustin Getz: From the links which you inserted follows that if one use **asynchronous completion callback** in WinHTTP one receive reenterant code. If you use the **asynchronous completion callback** from WinINET you will have some possible problems described in "Different Handling of Asynchronous Requests". I assumed that you use asynchronous callback, isn't you?
Oleg
Thanks, I didn't know about those restrictions.
Amigable Clark Kant