Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

miniz not used in the right place #84

Open
adah1972 opened this issue Jun 30, 2023 · 5 comments
Open

miniz not used in the right place #84

adah1972 opened this issue Jun 30, 2023 · 5 comments

Comments

@adah1972
Copy link

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.

@adah1972
Copy link
Author

adah1972 commented Jun 30, 2023

Defining MICROPROFILE_MAX_FRAME_HISTORY and MICROPROFILE_IMPL in the demo code does not make sense to me as well....

@jonasmr
Copy link
Owner

jonasmr commented Jun 30, 2023

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

@jonasmr
Copy link
Owner

jonasmr commented Jun 30, 2023

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

@adah1972
Copy link
Author

adah1972 commented Jul 1, 2023

I have moved the related code to microprofile.cpp, but I think you should know about it and adjust the official repo. :-)

@adah1972
Copy link
Author

adah1972 commented Jul 1, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants