My decision to use WinInet to implement my XMLHttpRequest class turned out to be a mistake! I went back to the drawing-board, and reimplemented the class using WinHttp, the more modern alternative from Microsoft. Here’s the code, the CPeteHttpRequest class that implements the classic XMLHttpRequest interface together with an app to test its use. It’s available for reuse with no restrictions.
Here’s the differences between this new version and the old WinInet-based one:
- It no longer crashes when under heavy multi-thread use
- The interface is now entirely in wide character strings
- WinHttp is only available on Windows 2000, XP and Vista, so use the WinInet code for legacy support