0
votes

I implement gzip on our Microchip TCP/IP embedded web server to compress static web resources (html, js, and css files) - The files get gzipped automagically when we upload the web site to the Microchip server.

However, I have a web page that is generated on the fly (it's not a static html page) and this page contains a lot of data (~2MB).

To speed up the download time (for the client), I would like to gzip the data prior to sending it to the client. Is this possible? Or are we limited to compressing only static files?

2

2 Answers

0
votes

Does the embedded web server do the compressing of the static files, or do you compress, then upload? In case of the latter, you can probably port the zlib library. See this question for details on how to compress a buffer on the fly.

0
votes

Dinamic gzipping will take a lot of time. I suggest you to have a static gzipped web-page skeleton with dinamically loading content:

1) on client request you response the static gzipped web-page;

2) this page has javascript code, so the client runs it;

3) javascript code uses AJAX to send a request on specific web-page (/ajax.html, for example);

4) on this page request you response the dinamic content only, uncompressed;

5) on this answer, javascript analizes it and places the data to the correct place on page;

6) profit.