What API to use for adding HTTP client support in an existing MFC app?
I have recently been given a task to add the ability to interact with Web Map Services to an existing MFC application and I am in need of a client-side HTTP API.
Based on my research, the leading candidates seem to be CAtlHttpClient and WinHTTP. I was curious to see if anyone had experiences they could share or opinions on which would be the better way to go (or suggestions for something else entirely).
At first glance, CAtlHttpClient seems to be a bit higher level and easier to use. However, in my research it seemed that any time people had a problem with not being able to do something with it, the answer was "use WinHTTP".
I wound up using WinHTTP because WinInet displays dialog boxes and our application is usable through a COM API. I avoided Ultimate TCP/IP because I work for a large company and getting third party software approved for use in a product is a complete nightmare.
WinHTTP, although a different API, is built on the same model as WinInet yet provides better HTTP support (no FTP though but you probably don't care). Whether you need the extra goodies provided by WinHTTP should be examined.
A down side of WinHTTP is that ATL/MFC don't provide wrappers for it, as opposed to WinInet.
And as Rob mentioned, UltimateTCP is a excellent alternative. One of its advantages is that it's a library: you link the code into your application, thereby eliminating DLL hell potential problems. Also, it comes with full source code which might be convenient if you run into a limitation of the implementation.
Make your pick!
Try Ultimate TCP/IP available for free from here:
It's a very good library and very easy to integrate with your apps.