MPD: HttpdClient Class Reference

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::HttpdClient | ( | HttpdOutput & | httpd,
|  | int | _fd,
|  | EventLoop & | _loop,
|  | bool | _metadata_supported
| ) |  |

Parameters

  httpd | the HTTP output device
  _fd | the socket file descriptor

## ◆ ~HttpdClient()

HttpdClient::~HttpdClient | ( |  | ) |

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

## Member Function Documentation

## ◆ BeginResponse()

void HttpdClient::BeginResponse | ( |  | ) |

Switch the client to the "RESPONSE" state.

## ◆ CancelQueue()

void HttpdClient::CancelQueue | ( |  | ) |

Clears the page queue.

## ◆ Close()

void HttpdClient::Close | ( |  | ) |

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

## ◆ GetBytesTillMetaData()

gcc_pure ssize_t HttpdClient::GetBytesTillMetaData | ( |  | ) | const
| noexcept

## ◆ HandleLine()

bool HttpdClient::HandleLine | ( | const char * | line | ) |

Handle a line of the HTTP request.

## ◆ LockClose()

void HttpdClient::LockClose | ( |  | ) |

## ◆ OnSocketClosed()

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

Implements BufferedSocket.

## ◆ OnSocketError()

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

Implements BufferedSocket.

## ◆ OnSocketInput()

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

Data has been received on the socket.

Parameters

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

Implements BufferedSocket.

## ◆ OnSocketReady()

virtual bool HttpdClient::OnSocketReady | ( | unsigned | flags | ) |
| overrideprotectedvirtual

Returns
  false if the socket has been closed

Reimplemented from BufferedSocket.

## ◆ PushMetaData()

void HttpdClient::PushMetaData | ( | Page * | page | ) |

Sends the passed metadata.

## ◆ PushPage()

void HttpdClient::PushPage | ( | Page * | page | ) |

Appends a page to the client's queue.

## ◆ SendResponse()

bool HttpdClient::SendResponse | ( |  | ) |

Sends the status line and response headers to the client.

## ◆ TryWrite()

bool HttpdClient::TryWrite | ( |  | ) |

## ◆ TryWritePage()

ssize_t HttpdClient::TryWritePage | ( | const Page & | page,
|  | size_t | position
| ) |  |

## ◆ TryWritePageN()

ssize_t HttpdClient::TryWritePageN | ( | const Page & | page,
|  | size_t | position,
|  | ssize_t | n
| ) |  |

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

- output/plugins/httpd/HttpdClient.hxx