libravatarserv/src
Nicholas Guriev a7c89b0e3f
Do not reopen stdout while image resizing
On Linux, some web-servers (Apache in particular) close file with fd = 1 and
offer something else as stdout. Notable difference can be seen with a pipe and
an immediate redirection. Consider:

  $ REQUEST_URI=/avatar/68b329da9893e34099c7d8ad5cb9c940 libravatarserv | cat > /tmp/response1.out
  $ REQUEST_URI=/avatar/68b329da9893e34099c7d8ad5cb9c940 libravatarserv > /tmp/response2.out
  $ diff -s /tmp/response{1,2}.out
  Binary files /tmp/response1.out and /tmp/response2.out differ

Solution.

The output should be identical in both cases. So do not let ImageMagick to open
/dev/stdout by itself, instead write the resulted image to an in-memory buffer
and then to a file associated with the "cout" global object.
2020-10-23 21:13:47 +03:00
..
hash.cpp Switched to identiconpp for identicon-generation. 2018-12-26 05:45:31 +01:00
http.cpp Update copyright years. 2019-02-28 19:49:46 +01:00
image.cpp Do not reopen stdout while image resizing 2020-10-23 21:13:47 +03:00
libravatarserv.cpp Update copyright years. 2019-02-28 19:49:46 +01:00
libravatarserv.hpp Initialize variables in Request and Image. 2019-02-20 03:04:23 +01:00
settings.cpp Refactored settings-stuff into own file. 2018-11-30 07:00:37 +01:00
version.hpp.in Initial commit 2018-11-24 11:38:10 +01:00