Anope IRC Services  Version 2.0
Public Member Functions | Data Fields | Private Types | Private Member Functions | Private Attributes
MyHTTPClient Class Reference
Inheritance diagram for MyHTTPClient:
Inheritance graph
[legend]
Collaboration diagram for MyHTTPClient:
Collaboration graph
[legend]

Public Member Functions

 MyHTTPClient (HTTPProvider *l, int f, const sockaddrs &a)
 
 ~MyHTTPClient ()
 
bool ProcessWrite () anope_override
 
const Anope::string GetIP () anope_override
 
bool Read (const char *buffer, size_t l) anope_override
 
bool Read (const Anope::string &buf)
 
void SendError (HTTPError err, const Anope::string &msg) anope_override
 
void SendReply (HTTPReply *msg) anope_override
 
- Public Member Functions inherited from HTTPClient
 HTTPClient (ListenSocket *l, int f, const sockaddrs &a)
 
- Public Member Functions inherited from ClientSocket
 ClientSocket (ListenSocket *ls, const sockaddrs &addr)
 
bool Process () anope_override
 
void ProcessError () anope_override
 
virtual void OnAccept ()
 
virtual void OnError (const Anope::string &error)
 
- Public Member Functions inherited from Socket
 Socket ()
 
 Socket (int sock, bool ipv6=false, int type=SOCK_STREAM)
 
virtual ~Socket ()
 
int GetFD () const
 
bool IsIPv6 () const
 
bool SetBlocking (bool state)
 
void Bind (const Anope::string &ip, int port=0)
 
- Public Member Functions inherited from BinarySocket
 BinarySocket ()
 
virtual ~BinarySocket ()
 
bool ProcessRead () anope_override
 
virtual void Write (const char *buffer, size_t l)
 
void Write (const char *message,...)
 
void Write (const Anope::string &message)
 
- Public Member Functions inherited from Base
 Base ()
 
virtual ~Base ()
 
void AddReference (ReferenceBase *r)
 
void DelReference (ReferenceBase *r)
 

Data Fields

time_t created
 
- Data Fields inherited from ClientSocket
ListenSocketls
 
sockaddrs clientaddr
 
- Data Fields inherited from Socket
std::bitset< SF_SIZEflags
 
sockaddrs bindaddr
 
SocketIOio
 

Private Types

enum  { ACTION_NONE, ACTION_GET, ACTION_POST }
 

Private Member Functions

void Serve ()
 

Private Attributes

HTTPProviderprovider
 
HTTPMessage message
 
bool header_done
 
bool served
 
Anope::string page_name
 
Reference< HTTPPagepage
 
Anope::string ip
 
unsigned content_length
 
enum MyHTTPClient:: { ... }  action
 

Additional Inherited Members

- Protected Member Functions inherited from HTTPClient
void WriteClient (const Anope::string &message)
 
- Protected Attributes inherited from Socket
int sock
 
bool ipv6
 
- Protected Attributes inherited from BinarySocket
std::deque< DataBlock * > write_buffer
 

Detailed Description

Definition at line 39 of file m_httpd.cpp.

Member Enumeration Documentation

anonymous enum
private
Enumerator
ACTION_NONE 
ACTION_GET 
ACTION_POST 

Definition at line 50 of file m_httpd.cpp.

Constructor & Destructor Documentation

MyHTTPClient::MyHTTPClient ( HTTPProvider l,
int  f,
const sockaddrs a 
)
inline

Definition at line 96 of file m_httpd.cpp.

References sockaddrs::addr(), and LOG_DEBUG.

MyHTTPClient::~MyHTTPClient ( )
inline

Definition at line 101 of file m_httpd.cpp.

References Socket::GetFD(), ip, and LOG_DEBUG.

Member Function Documentation

const Anope::string MyHTTPClient::GetIP ( )
inlinevirtual

Reimplemented from HTTPClient.

Definition at line 112 of file m_httpd.cpp.

References ip.

bool MyHTTPClient::ProcessWrite ( )
inlinevirtual

Called when the socket is ready to be written to

Returns
true on success, false to drop this socket

Reimplemented from BinarySocket.

Definition at line 107 of file m_httpd.cpp.

References BinarySocket::ProcessWrite(), and BinarySocket::write_buffer.

bool MyHTTPClient::Read ( const char *  buffer,
size_t  l 
)
inlinevirtual

Called with data from the socket

Parameters
bufferThe data
lThe length of buffer
Returns
true to continue reading, false to drop the socket

Reimplemented from BinarySocket.

Definition at line 117 of file m_httpd.cpp.

References sockaddrs::addr(), Anope::string::append(), ClientSocket::clientaddr, HTTPMessage::content, content_length, Anope::string::empty(), Anope::string::find(), sepstream::GetToken(), Anope::string::length(), LOG_DEBUG_2, Anope::string::npos, HTTPMessage::post_data, Serve(), Anope::string::substr(), Anope::string::trim(), and HTTPUtils::URLDecode().

bool MyHTTPClient::Read ( const Anope::string buf)
inline
void MyHTTPClient::SendError ( HTTPError  err,
const Anope::string msg 
)
inlinevirtual

Implements HTTPClient.

Definition at line 235 of file m_httpd.cpp.

References HTTPReply::error, SendReply(), and HTTPReply::Write().

Referenced by Read(), and Serve().

void MyHTTPClient::SendReply ( HTTPReply msg)
inlinevirtual
void MyHTTPClient::Serve ( )
inlineprivate

Field Documentation

enum { ... } MyHTTPClient::action

Referenced by Read().

unsigned MyHTTPClient::content_length
private

Definition at line 48 of file m_httpd.cpp.

Referenced by Read().

time_t MyHTTPClient::created

Definition at line 94 of file m_httpd.cpp.

Referenced by MyHTTPProvider::Tick().

bool MyHTTPClient::header_done
private

Definition at line 43 of file m_httpd.cpp.

Anope::string MyHTTPClient::ip
private

Definition at line 46 of file m_httpd.cpp.

Referenced by GetIP(), Serve(), and ~MyHTTPClient().

HTTPMessage MyHTTPClient::message
private

Definition at line 42 of file m_httpd.cpp.

Reference<HTTPPage> MyHTTPClient::page
private

Definition at line 45 of file m_httpd.cpp.

Anope::string MyHTTPClient::page_name
private

Definition at line 44 of file m_httpd.cpp.

HTTPProvider* MyHTTPClient::provider
private

Definition at line 41 of file m_httpd.cpp.

bool MyHTTPClient::served
private

Definition at line 43 of file m_httpd.cpp.


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