C++ WinHttp wrapper class

by tsachi 14. March 2009 14:57

The source code for WinHttp wrapper covers the followings methods:

BOOL AddRequestHeaders( LPCWSTR pwszHeaders, DWORD dwHeadersLength, DWORD dwModifiers );

static BOOL CheckPlatform(void);

BOOL CloseSession();

BOOL CloseConnection();

BOOL CloseRequest();

BOOL Connect( LPCWSTR pswzServerName, INTERNET_PORT nServerPort );

BOOL CrackUrl( LPCWSTR pwszUrl, DWORD dwUrlLength, DWORD dwFlags, LPURL_COMPONENTS lpUrlComponents );

BOOL CreateUrl( LPURL_COMPONENTS lpUrlComponents, DWORD dwFlags, LPWSTR pwszUrl, LPDWORD lpdwUrlLength );

BOOL DetectAutoProxyConfigUrl( DWORD dwAutoDetectFlags, LPWSTR* ppwszAutoConfigUrl );

static BOOL GetDefaultProxyConfiguration( WINHTTP_PROXY_INFO* pProxyInfo );static BOOL GetIEProxyConfigForCurrentUser( WINHTTP_CURRENT_USER_IE_PROXY_CONFIG* pProxyConfig );

BOOL GetProxyForUrl( LPCWSTR lpcwszUrl, WINHTTP_AUTOPROXY_OPTIONS* pAutoProxyOptions, WINHTTP_PROXY_INFO* pProxyInfo );

BOOL Open( LPCWSTR pwszUserAgent, DWORD dwAccessType, LPCWSTR pwszProxyName, LPCWSTR pwszProxyBypass, DWORD dwFlags );

BOOL OpenRequest( LPCWSTR pwszVerb, LPCWSTR pwszObjectName, LPCWSTR pwszVersion, LPCWSTR pwszReferrer, LPCWSTR* ppwszAcceptTypes, DWORD dwFlags );

BOOL QueryAuthSchemes( LPDWORD lpdwSupportedSchemes, LPDWORD lpdwFirstScheme, LPDWORD pdwAuthTarget );

BOOL QueryDataAvailable( LPDWORD lpdwNumberOfBytesAvailable );

BOOL QueryHeaders( DWORD dwInfoLevel, LPCWSTR pwszName, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex );

BOOL QuerySessionOption( DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength );

BOOL QueryRequestOption( DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength );

BOOL ReadData( LPVOID lpBuffer, DWORD dwNumberOfBytesToRead, LPDWORD lpdwNumberOfBytesRead );

BOOL ReceiveResponse( );

BOOL SendRequest( LPCWSTR pwszHeaders, DWORD dwHeadersLength, LPVOID lpOptional, DWORD dwOptionalLength, DWORD dwTotalLength, DWORD_PTR dwContext );

BOOL SetCredentials( DWORD AuthTargets, DWORD AuthScheme, LPCWSTR pwszUserName, LPCWSTR pwszPassword, LPVOID pAuthParams );

BOOL SetDefaultProxyConfiguration( WINHTTP_PROXY_INFO* pProxyInfo );

BOOL SetSessionOption( DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength );

BOOL SetRequestOption( DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength );

WINHTTP_STATUS_CALLBACK SetStatusCallback( WINHTTP_STATUS_CALLBACK lpfnInternetCallback, DWORD dwNotificationFlags);

BOOL SetTimeouts(
int dwResolveTimeout, int dwConnectTimeout, int dwSendTimeout, int dwReceiveTimeout );

static BOOL TimeFromSystemTime( SYSTEMTIME* pst, LPWSTR pwszTime );

static BOOL TimeToSystemTime( LPCWSTR pwszTime, SYSTEMTIME* pst );

BOOL WriteData( LPCVOID lpBuffer, DWORD dwNumberOfBytesToWrite, LPDWORD lpdwNumberOfBytesWritten );

 

 

WinHttp.cpp (6.92 kb)

WinHttp.h (2.83 kb)

 

 

Tags: , , , , ,

C/C++

Advertisements

About the author

9+ years experience in software, software engineering, software development, software architecture, software development methodology and practices, web, internet, intranet, distributed application, client/server, object-oriented analysis and design, requirements analysis and modeling, data modeling, and database design. Progressed through end-user application, servers and databases work to management positions. Held positions with management responsibility, including training and technological leading, for up to 5 employees. Engaged in computer applications development with focus over video streaming, web and security.