PixelLightAPI  .
Public Member Functions | Protected Member Functions
PLCore::HttpClient Class Reference

Http server. More...

#include <HttpClient.h>

Inheritance diagram for PLCore::HttpClient:
Inheritance graph
[legend]

List of all members.

Public Member Functions

PLCORE_API HttpClient ()
 Constructor.
virtual PLCORE_API ~HttpClient ()
 Destructor.
EClientSignature GetClientSignature () const
 Get client signature.
void SetClientSignature (EClientSignature nClientSignature)
 Set client signature.
EHttpProtocol GetProtocol () const
 Get protocol version.
void SetProtocol (EHttpProtocol nProtocol)
 Set protocol version.
EHttpConnection GetConnectionType () const
 Get connection type.
void SetConnectionType (EHttpConnection nConnection)
 Set connection type.
EHttpAuth GetAuthentication () const
 Get authentication.
void SetAuthentication (EHttpAuth nAuth, const String &sUsername, const String &sPassword)
 Set authentication.
bool IsConnected () const
 Check if a connection is open.
PLCORE_API bool Open (const String &sAddress, uint32 nPort=80)
 Open connection to server.
PLCORE_API void Disconnect ()
 Close HTTP session.
PLCORE_API bool Get (const String &sURL)
 Open a HTTP resource (GET command)
PLCORE_API bool GetPartial (const String &sURL, uint32 nPos, int32 nSize=-1)
 Open a HTTP resource and get partial data (GET command)
PLCORE_API bool Post (const String &sURL, const String &sPostData)
 Open a HTTP resource (POST command)
PLCORE_API bool Delete (const String &sURL)
 Delete a HTTP resource (DELETE command)
const HttpHeaderGetHeader () const
 Get HTTP header sent from server.
PLCORE_API int Read (char *pBuffer, uint32 nSize)
 Read data from HTTP connection.

Protected Member Functions

virtual PLCORE_API ConnectionCreateOutgoingConnection () override
 Create a new outgoing connection.
virtual PLCORE_API void OnDisconnect (Connection &cConnection) override
 Called when a connection is closed.

Detailed Description

Http server.


Constructor & Destructor Documentation

virtual PLCORE_API PLCore::HttpClient::~HttpClient ( ) [virtual]

Destructor.


Member Function Documentation

Get client signature.

Returns:
Client signature
void PLCore::HttpClient::SetClientSignature ( EClientSignature  nClientSignature) [inline]

Set client signature.

Parameters:
[in]nClientSignatureClient signature
Remarks:
Usually, this HTTP client will send "PixelLight HTTP Client" as it's client identification, so the server will know, who we are ;-) If you want to mimic other clients, you can set this to another value, e.g. to mimic a Mozilla client.

Get protocol version.

Returns:
HTTP protocol version
void PLCore::HttpClient::SetProtocol ( EHttpProtocol  nProtocol) [inline]

Set protocol version.

Parameters:
[in]nProtocolHTTP protocol version

Get connection type.

Returns:
HTTP connection type

Set connection type.

Parameters:
[in]nConnectionHTTP connection type

Get authentication.

Returns:
HTTP authentication type
void PLCore::HttpClient::SetAuthentication ( EHttpAuth  nAuth,
const String sUsername,
const String sPassword 
) [inline]

Set authentication.

Parameters:
[in]nAuthHTTP authentication type
[in]sUsernameUser name
[in]sPasswordPassword
bool PLCore::HttpClient::IsConnected ( ) const [inline]

Check if a connection is open.

Returns:
'true' if connection is open, else 'false'
PLCORE_API bool PLCore::HttpClient::Open ( const String sAddress,
uint32  nPort = 80 
)

Open connection to server.

Parameters:
[in]sAddressServer address
[in]nPortPort number (Default: 80)
Returns:
'true' if all went fine, else 'false'
PLCORE_API void PLCore::HttpClient::Disconnect ( )

Close HTTP session.

PLCORE_API bool PLCore::HttpClient::Get ( const String sURL)

Open a HTTP resource (GET command)

Parameters:
[in]sURLURL
Returns:
'true' if all went fine, else 'false'
PLCORE_API bool PLCore::HttpClient::GetPartial ( const String sURL,
uint32  nPos,
int32  nSize = -1 
)

Open a HTTP resource and get partial data (GET command)

Parameters:
[in]sURLURL
[in]nPosStart offset
[in]nSizeSize of data to read (-1 for all)
Returns:
'true' if all went fine, else 'false'
PLCORE_API bool PLCore::HttpClient::Post ( const String sURL,
const String sPostData 
)

Open a HTTP resource (POST command)

Parameters:
[in]sURLURL
[in]sPostDataAdditional data for POST command
Returns:
'true' if all went fine, else 'false'
PLCORE_API bool PLCore::HttpClient::Delete ( const String sURL)

Delete a HTTP resource (DELETE command)

Parameters:
[in]sURLURL
Returns:
'true' if all went fine, else 'false'
const HttpHeader & PLCore::HttpClient::GetHeader ( ) const [inline]

Get HTTP header sent from server.

Returns:
Header of HTTP answer from server
PLCORE_API int PLCore::HttpClient::Read ( char *  pBuffer,
uint32  nSize 
)

Read data from HTTP connection.

Parameters:
[in]pBufferData buffer
[in]nSizeSize in bytes
Returns:
Total number of bytes read. Can be less than the requested size to be sent, negative value on error
virtual PLCORE_API Connection* PLCore::HttpClient::CreateOutgoingConnection ( ) [override, protected, virtual]

Create a new outgoing connection.

Returns:
Connection

Reimplemented from PLCore::Client.

virtual PLCORE_API void PLCore::HttpClient::OnDisconnect ( Connection cConnection) [override, protected, virtual]

Called when a connection is closed.

Parameters:
[in]cConnectionThe closed connection

Reimplemented from PLCore::Host.


The documentation for this class was generated from the following files:


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:26
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported