|
|||
|
|||
|
Inheritance diagram for HttpServerSocket:


Public Member Functions | |
| HttpServerSocket (InspIRCd *SI, std::string shost, int iport, bool listening, unsigned long maxtime, FileReader *index_page) | |
| HttpServerSocket (InspIRCd *SI, int newfd, char *ip, FileReader *ind) | |
| FileReader * | GetIndex () |
| ~HttpServerSocket () | |
| virtual int | OnIncomingConnection (int newsock, char *ip) |
| If your socket is a listening socket, when a new connection comes in on the socket this method will be called. | |
| virtual void | OnClose () |
| Whenever close() is called, OnClose() will be called first. | |
| std::string | Response (int response) |
| void | SendHTTPError (int response) |
| void | SendHeaders (unsigned long size, int response, HTTPHeaders &rheaders) |
| virtual bool | OnDataReady () |
| When there is data waiting to be read on a socket, the OnDataReady() method is called. | |
| void | CheckRequestBuffer () |
| void | ServeData () |
| bool | OnWriteReady () |
| When it is ok to write to the socket, and a write event was requested, this method is triggered. | |
| void | Page (std::stringstream *n, int response, HTTPHeaders *hheaders) |
| void | SetWrite () |
Private Attributes | |
| FileReader * | index |
| HttpState | InternalState |
| HTTPHeaders | headers |
| std::string | reqbuffer |
| std::string | postdata |
| unsigned int | postsize |
| std::string | request_type |
| std::string | uri |
| std::string | http_version |
Definition at line 37 of file m_httpd.cpp.
|
||||||||||||||||||||||||||||
|
Definition at line 52 of file m_httpd.cpp. References HTTP_LISTEN, and InternalState. Referenced by OnIncomingConnection(). |
|
||||||||||||||||||||
|
Definition at line 57 of file m_httpd.cpp. References HTTP_SERVE_WAIT_REQUEST, and InternalState. |
|
|
Definition at line 67 of file m_httpd.cpp. |
|
|
Definition at line 246 of file m_httpd.cpp. References HTTPHeaders::GetHeader(), headers, HTTP_SERVE_RECV_POSTDATA, http_version, InternalState, HTTPHeaders::IsSet(), postdata, postsize, reqbuffer, request_type, SendHTTPError(), ServeData(), HTTPHeaders::SetHeader(), SetWrite(), and uri. Referenced by OnDataReady(). |
|
|
Definition at line 62 of file m_httpd.cpp. References index. |
|
|
Whenever close() is called, OnClose() will be called first. Please note that this means OnClose will be called alongside OnError(), OnTimeout(), and Close(), and also when cancelling a listening socket by calling the destructor indirectly. Reimplemented from BufferedSocket. Definition at line 80 of file m_httpd.cpp. |
|
|
When there is data waiting to be read on a socket, the OnDataReady() method is called. Within this method, you *MUST* call the Read() method to read any pending data. At its lowest level, this event is signalled by the core via the socket engine. If you return false from this function, the core removes your socket from its list and erases it from the socket engine, then calls BufferedSocket::Close() and deletes it.
Reimplemented from BufferedSocket. Definition at line 214 of file m_httpd.cpp. References CheckRequestBuffer(), DEBUG, HTTP_SERVE_RECV_POSTDATA, HTTP_SERVE_WAIT_REQUEST, BufferedSocket::Instance, InternalState, LogManager::Log(), InspIRCd::Logs, postdata, postsize, BufferedSocket::Read(), reqbuffer, and ServeData(). |
|
||||||||||||
|
If your socket is a listening socket, when a new connection comes in on the socket this method will be called. Given the new file descriptor in the parameters, and the IP, it is recommended you copy them to a new instance of your socket class, e.g.: MySocket* newsocket = new MySocket(newfd,ip); Once you have done this, you can then associate the new socket with the core using Server::AddSocket(). Reimplemented from BufferedSocket. Definition at line 71 of file m_httpd.cpp. References HTTP_LISTEN, HttpServerSocket(), index, and InternalState. |
|
|
When it is ok to write to the socket, and a write event was requested, this method is triggered. Within this method you should call write() or send() etc, to send data to the other end of the socket. Further write events will not be triggered unless you call WantWrite().
Reimplemented from BufferedSocket. Definition at line 360 of file m_httpd.cpp. References DEBUG, BufferedSocket::Instance, LogManager::Log(), and InspIRCd::Logs. |
|
||||||||||||||||
|
Definition at line 366 of file m_httpd.cpp. References BufferedSocket::FlushWriteBuffer(), SendHeaders(), SetWrite(), and BufferedSocket::Write(). Referenced by ModuleHttpServer::OnRequest(). |
|
|
Definition at line 84 of file m_httpd.cpp. Referenced by SendHeaders(), and SendHTTPError(). |
|
||||||||||||||||
|
Definition at line 186 of file m_httpd.cpp. References ConvToStr(), HTTPHeaders::CreateHeader(), HTTPHeaders::GetFormattedHeaders(), http_version, BufferedSocket::Instance, HTTPHeaders::RemoveHeader(), Response(), HTTPHeaders::SetHeader(), InspIRCd::Time(), and BufferedSocket::Write(). Referenced by Page(), SendHTTPError(), and ServeData(). |
|
|
Definition at line 175 of file m_httpd.cpp. References ConvToStr(), BufferedSocket::FlushWriteBuffer(), Response(), SendHeaders(), and BufferedSocket::Write(). Referenced by CheckRequestBuffer(), and ServeData(). |
|
|
Definition at line 328 of file m_httpd.cpp. References claimed, FileReader::Contents(), FileReader::ContentSize(), BufferedSocket::FlushWriteBuffer(), headers, HTTP_SERVE_SEND_DATA, index, InternalState, postdata, request_type, Event::Send(), SendHeaders(), SendHTTPError(), SetWrite(), uri, and BufferedSocket::Write(). Referenced by CheckRequestBuffer(), and OnDataReady(). |
|
|
Definition at line 374 of file m_httpd.cpp. References DEBUG, BufferedSocket::Instance, LogManager::Log(), InspIRCd::Logs, InspIRCd::SE, BufferedSocket::WaitingForWriteEvent, and SocketEngine::WantWrite(). Referenced by CheckRequestBuffer(), Page(), and ServeData(). |
|
|
Definition at line 42 of file m_httpd.cpp. Referenced by CheckRequestBuffer(), and ServeData(). |
|
|
Definition at line 48 of file m_httpd.cpp. Referenced by CheckRequestBuffer(), and SendHeaders(). |
|
|
Definition at line 39 of file m_httpd.cpp. Referenced by GetIndex(), OnIncomingConnection(), and ServeData(). |
|
|
Definition at line 40 of file m_httpd.cpp. Referenced by CheckRequestBuffer(), HttpServerSocket(), OnDataReady(), OnIncomingConnection(), and ServeData(). |
|
|
Definition at line 44 of file m_httpd.cpp. Referenced by CheckRequestBuffer(), OnDataReady(), and ServeData(). |
|
|
Definition at line 45 of file m_httpd.cpp. Referenced by CheckRequestBuffer(), and OnDataReady(). |
|
|
Definition at line 43 of file m_httpd.cpp. Referenced by CheckRequestBuffer(), and OnDataReady(). |
|
|
Definition at line 46 of file m_httpd.cpp. Referenced by CheckRequestBuffer(), and ServeData(). |
|
|
Definition at line 47 of file m_httpd.cpp. Referenced by CheckRequestBuffer(), and ServeData(). |