EvEmu
0.8.4
11 September 2021
|
Handles a client connection to the image server. More...
#include "ImageServerConnection.h"
Public Member Functions | |
void | Process () |
boost::asio::ip::tcp::socket & | socket () |
Static Public Member Functions | |
static std::shared_ptr < ImageServerConnection > | create (boost::asio::io_context &io) |
Private Member Functions | |
ImageServerConnection (boost::asio::io_context &io) | |
void | ProcessHeaders () |
void | SendImage () |
void | NotFound () |
void | Close () |
void | Redirect () |
void | RedirectLocation () |
void | RedirectFinalize () |
Static Private Member Functions | |
static bool | starts_with (std::string &haystack, const char *const needle) |
Private Attributes | |
std::string | _category |
uint32 | _id |
uint32 | _size |
std::string | _redirectUrl |
boost::asio::streambuf | _buffer |
boost::asio::ip::tcp::socket | _socket |
std::shared_ptr< std::vector < char > > | _imageData |
Static Private Attributes | |
static boost::asio::const_buffers_1 | _responseOK = boost::asio::buffer("HTTP/1.0 200 OK\r\nContent-Type: image/jpeg\r\n\r\n", 45) |
static boost::asio::const_buffers_1 | _responseNotFound = boost::asio::buffer("HTTP/1.0 404 Not Found\r\n\r\n", 26) |
static boost::asio::const_buffers_1 | _responseRedirectBegin = boost::asio::buffer("HTTP/1.0 301 Moved Permanently\r\nLocation: ", 42) |
static boost::asio::const_buffers_1 | _responseRedirectEnd = boost::asio::buffer("\r\n\r\n", 4) |
Handles a client connection to the image server.
Handles exactly one client; does all the protocol related stuff. Very limited HTTP handling.
Definition at line 41 of file ImageServerConnection.h.
|
private |
Definition at line 33 of file ImageServerConnection.cpp.
Referenced by create().
|
private |
Definition at line 154 of file ImageServerConnection.cpp.
References _socket.
Referenced by NotFound(), RedirectFinalize(), and SendImage().
|
static |
Definition at line 164 of file ImageServerConnection.cpp.
References ImageServerConnection().
Referenced by ImageServerListener::StartAccept().
|
private |
Definition at line 129 of file ImageServerConnection.cpp.
References _responseNotFound, _socket, and Close().
Referenced by ProcessHeaders().
void ImageServerConnection::Process | ( | ) |
Definition at line 47 of file ImageServerConnection.cpp.
References _buffer, _socket, and ProcessHeaders().
|
private |
Definition at line 53 of file ImageServerConnection.cpp.
References _buffer, _category, _id, _imageData, _responseOK, _size, _socket, ImageServer::Categories, ImageServer::CategoryCount, IsCharacterID, IsPlayerItem, NotFound(), Redirect(), SendImage(), sImageServer, sLog, and starts_with().
Referenced by Process().
|
private |
Definition at line 134 of file ImageServerConnection.cpp.
References _responseRedirectBegin, _socket, and RedirectLocation().
Referenced by ProcessHeaders().
|
private |
Definition at line 149 of file ImageServerConnection.cpp.
References _responseRedirectEnd, _socket, and Close().
Referenced by RedirectLocation().
|
private |
Definition at line 139 of file ImageServerConnection.cpp.
References _category, _id, _redirectUrl, _size, _socket, ImageServer::FallbackURL, RedirectFinalize(), and sLog.
Referenced by Redirect().
|
private |
Definition at line 124 of file ImageServerConnection.cpp.
References _imageData, _socket, and Close().
Referenced by ProcessHeaders().
boost::asio::ip::tcp::socket & ImageServerConnection::socket | ( | ) |
Definition at line 42 of file ImageServerConnection.cpp.
References _socket.
|
staticprivate |
Definition at line 159 of file ImageServerConnection.cpp.
Referenced by ProcessHeaders().
|
private |
Definition at line 66 of file ImageServerConnection.h.
Referenced by Process(), and ProcessHeaders().
|
private |
Definition at line 61 of file ImageServerConnection.h.
Referenced by ProcessHeaders(), and RedirectLocation().
|
private |
Definition at line 62 of file ImageServerConnection.h.
Referenced by ProcessHeaders(), and RedirectLocation().
|
private |
Definition at line 68 of file ImageServerConnection.h.
Referenced by ProcessHeaders(), and SendImage().
|
private |
Definition at line 64 of file ImageServerConnection.h.
Referenced by RedirectLocation().
|
staticprivate |
Definition at line 71 of file ImageServerConnection.h.
Referenced by NotFound().
|
staticprivate |
Definition at line 70 of file ImageServerConnection.h.
Referenced by ProcessHeaders().
|
staticprivate |
Definition at line 72 of file ImageServerConnection.h.
Referenced by Redirect().
|
staticprivate |
Definition at line 73 of file ImageServerConnection.h.
Referenced by RedirectFinalize().
|
private |
Definition at line 63 of file ImageServerConnection.h.
Referenced by ProcessHeaders(), and RedirectLocation().
|
private |
Definition at line 67 of file ImageServerConnection.h.
Referenced by Close(), NotFound(), Process(), ProcessHeaders(), Redirect(), RedirectFinalize(), RedirectLocation(), SendImage(), and socket().