forked from tastytea/libravatarserv
Bugfix: detect file type and send appropriate Content-Type.
This commit is contained in:
parent
b3593a95f0
commit
ec140aad01
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required (VERSION 3.2)
|
cmake_minimum_required (VERSION 3.2)
|
||||||
project(libravatarserv
|
project(libravatarserv
|
||||||
VERSION 0.6.2
|
VERSION 0.6.3
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <algorithm>
|
||||||
#include "libravatarserv.hpp"
|
#include "libravatarserv.hpp"
|
||||||
|
|
||||||
using std::cout;
|
using std::cout;
|
||||||
|
@ -67,7 +68,10 @@ const Image image::get(const string &digest, const uint16_t size)
|
||||||
|
|
||||||
void image::write(Image &image)
|
void image::write(Image &image)
|
||||||
{
|
{
|
||||||
cout << "Content-type: image/png\n\n";
|
string magick = image.image.magick();
|
||||||
|
std::transform(magick.begin(), magick.end(), magick.begin(), ::tolower);
|
||||||
|
|
||||||
|
cout << "Content-Type: image/" << magick << "\n\n";
|
||||||
cout.flush(); // We need to flush before we use /dev/stdout directly.
|
cout.flush(); // We need to flush before we use /dev/stdout directly.
|
||||||
image.image.write("/dev/stdout");
|
image.image.write("/dev/stdout");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user