59 std::getline(stream, request,
'\r');
66 request = request.substr(5);
90 request = request.substr(1);
92 int del = request.find_first_of(
'_');
93 if (del == std::string::npos)
100 std::string idStr = request.substr(0, del);
101 std::string sizeStr = request.substr(del + 1);
102 _id = atoi(idStr.c_str());
103 _size = atoi(sizeStr.c_str());
108 sLog.Error(
" Image Server",
"Image for itemID %u not found.",
_id);
112 sLog.Error(
" Image Server",
"Image for charID %u not found.",
_id);
141 sLog.Error(
" Image Server",
" RedirectLocation() called.");
142 std::string extension =
_category ==
"Character" ?
"jpg" :
"png";
143 std::stringstream url;
161 return haystack.substr(0, strlen(needle)).compare(needle) == 0;
static const char *const Categories[]
static const char *const FallbackURL
static std::shared_ptr< ImageServerConnection > create(boost::asio::io_context &io)
static boost::asio::const_buffers_1 _responseRedirectEnd
Handles distribution of character and related game images.
static boost::asio::const_buffers_1 _responseNotFound
#define sLog
Evaluates to a NewLog instance.
std::shared_ptr< std::vector< char > > _imageData
boost::asio::ip::tcp::socket _socket
static boost::asio::const_buffers_1 _responseRedirectBegin
#define IsPlayerItem(itemID)
static const uint32 CategoryCount
static boost::asio::const_buffers_1 _responseOK
#define IsCharacterID(itemID)
boost::asio::ip::tcp::socket & socket()
boost::asio::streambuf _buffer
static bool starts_with(std::string &haystack, const char *const needle)
ImageServerConnection(boost::asio::io_context &io)