MPD  0.20.18
Public Member Functions | Protected Member Functions
HttpdClient Class Referencefinal

#include <HttpdClient.hxx>

Inheritance diagram for HttpdClient:
[legend]
Collaboration diagram for HttpdClient:
[legend]

Public Member Functions

 HttpdClient (HttpdOutput &httpd, int _fd, EventLoop &_loop, bool _metadata_supported)
 
 ~HttpdClient ()
 Note: this does not remove the client from the HttpdOutput object. More...
 
void Close ()
 Frees the client and removes it from the server's client list. More...
 
void LockClose ()
 
void CancelQueue ()
 Clears the page queue. More...
 
bool HandleLine (const char *line)
 Handle a line of the HTTP request. More...
 
void BeginResponse ()
 Switch the client to the "RESPONSE" state. More...
 
bool SendResponse ()
 Sends the status line and response headers to the client. More...
 
gcc_pure ssize_t GetBytesTillMetaData () const noexcept
 
ssize_t TryWritePage (const Page &page, size_t position)
 
ssize_t TryWritePageN (const Page &page, size_t position, ssize_t n)
 
bool TryWrite ()
 
void PushPage (Page *page)
 Appends a page to the client's queue. More...
 
void PushMetaData (Page *page)
 Sends the passed metadata. More...
 

Protected Member Functions

virtual bool OnSocketReady (unsigned flags) override
 
virtual InputResult OnSocketInput (void *data, size_t length) override
 Data has been received on the socket. More...
 
void OnSocketError (std::exception_ptr ep) override
 
virtual void OnSocketClosed () override
 

Detailed Description

Definition at line 37 of file HttpdClient.hxx.

Constructor & Destructor Documentation

HttpdClient::HttpdClient ( HttpdOutput httpd,
int  _fd,
EventLoop _loop,
bool  _metadata_supported 
)
Parameters
httpdthe HTTP output device
_fdthe socket file descriptor
HttpdClient::~HttpdClient ( )

Note: this does not remove the client from the HttpdOutput object.

Member Function Documentation

void HttpdClient::BeginResponse ( )

Switch the client to the "RESPONSE" state.

void HttpdClient::CancelQueue ( )

Clears the page queue.

void HttpdClient::Close ( )

Frees the client and removes it from the server's client list.

gcc_pure ssize_t HttpdClient::GetBytesTillMetaData ( ) const
noexcept
bool HttpdClient::HandleLine ( const char *  line)

Handle a line of the HTTP request.

void HttpdClient::LockClose ( )
virtual void HttpdClient::OnSocketClosed ( )
overrideprotectedvirtual

Implements BufferedSocket.

void HttpdClient::OnSocketError ( std::exception_ptr  ep)
overrideprotectedvirtual

Implements BufferedSocket.

virtual InputResult HttpdClient::OnSocketInput ( void *  data,
size_t  length 
)
overrideprotectedvirtual

Data has been received on the socket.

Parameters
dataa pointer to the beginning of the buffer; the buffer may be modified by the method while it processes the data

Implements BufferedSocket.

virtual bool HttpdClient::OnSocketReady ( unsigned  flags)
overrideprotectedvirtual
Returns
false if the socket has been closed

Reimplemented from BufferedSocket.

void HttpdClient::PushMetaData ( Page page)

Sends the passed metadata.

void HttpdClient::PushPage ( Page page)

Appends a page to the client's queue.

bool HttpdClient::SendResponse ( )

Sends the status line and response headers to the client.

bool HttpdClient::TryWrite ( )
ssize_t HttpdClient::TryWritePage ( const Page page,
size_t  position 
)
ssize_t HttpdClient::TryWritePageN ( const Page page,
size_t  position,
ssize_t  n 
)

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