WinHTTP 5.1

 

Microsoft Windows HTTP Services (WinHTTP) provides developers with a server-supported, high-level interface to the HTTP/1.1 Internet protocol. WinHTTP is designed to be used primarily in server-based scenarios by server applications that communicate with HTTP servers.

 

WinHTTP is also designed for use in system services and HTTP-based client applications. WinHTTP is more secure and robust than WinINet. However, single-user applications that require FTP or Gopher protocol functionality, cookie persistence, caching, automatic credential dialog handling, Internet Explorer compatibility, or downlevel platform support should consider using WinInet.

 

This interface is accessible from PowerBASIC by using either the WinHTTP application programming interface (API), the IWinHttpRequest and IWinHttpRequestEvents interfaces, or through the WinHTTP object.

 

Before you begin to develop a Microsoft Windows HTTP Services (WinHTTP) application, you must first decide whether to use the API or the COM interface. The following table summarizes the advantages and disadvantages associated with each of these approaches.

 


API

COM interface

Advantages

Responses can be processed in chunks, which is more efficient.
POST operations can also be processed in chunks, speeding processing time.
AutoProxy support.
Access to the full feature set of WinHTTP.
Binary data can easily be handled.
Creating an application is easy and requires fewer lines of code than the C/C++ API.
The interface can be used by scripting languages.

Disadvantages

Processing is more complex.
The C/C++ API requires more steps than the COM interface to perform the same actions.
Setting up a request takes more code.
The COM interface does not provide access to the full feature set of WinHTTP.
It is difficult to handle binary data types in some scripting languages, such as VBScript and JScript.
The COM interface does not support AutoProxy.
Applications must use the COM APARTMENT_THREADED model.
Before a response can begin being processed, the entire response must first be received and buffered.

 

Valid XHTML 1.0 Transitional