miniz not used in the right place
Opened this issue · 5 comments
Currently MICROPROFILE_MINIZ
is defined to 1 in the demos and "miniz.c" is included there. However, no one really uses it. I also checked the web server response and found no deflate.
I then moved the MICROPROFILE_MINIZ
-related stuff to the beginning of microprofile.cpp (I also needed to copy the miniz.c file). Now I can really see "Content-Encoding: deflate" in the HTTP response header.
So I think the source and demo files should be changed, and miniz.c should have only one copy and be in the same directory as microprofile.cpp.
Defining MICROPROFILE_MAX_FRAME_HISTORY
and MICROPROFILE_IMPL
in the demo code does not make sense to me as well....
Hi, yes, you are right. I think its a leftover from when the code was all in microprofile.h, defining MICROPROFILE_IMPL, with .._MINIZ defined would enable the code.
Seems like that functionality was lost when I moved the code to the .cpp file
So, its the demo thats broken but the feature is not.
You just have to define MICROPROFILE_MINIZ to 1 in your build script, and then it'd be defined when microprofile.cpp is compiled.
Same thing for MAX_FRAME_HISTORY
I have moved the related code to microprofile.cpp, but I think you should know about it and adjust the official repo. :-)
You just have to define MICROPROFILE_MINIZ to 1 in your build script
Not necessary and not enough. You need to put these lines at the beginning of microprofile.cpp:
//generate zipped results
#define MICROPROFILE_MINIZ 1
#if MICROPROFILE_MINIZ
#include "miniz.c"
#endif
In fact, you can even remove this macro and hard-include miniz.c in microprofile.cpp, if it is not necessary to keep the no-zip option.