AlixAbbasi / mongoose

Mongoose Embedded HTTP Server
MIT License
0 stars 0 forks source link

Gzipped content support #368

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I see that there were numerous requests to have gzipped files served via 
mongoose. This is my solution, as I also needed to serve content from my 
embedded equipment through a sloooow GPRS link. The concept is as follows:

Check request header for Allow-Encoding:gzip, if it is found, then when you 
want to open the file to send, check if there is a copy of the same file with a 
'.gz' extension, if so, serve that one instead, update the Content-Length 
parameter to reflect the shorter file and add an extra line 'Content-Encoding: 
gzip\r\n' to the response header.

The attatched file is my attempt at providing this feature, to use it,
replace the 'handle_file_request()' function in mongoose.c with my version, 
NOTE! Not implemented for ssi.

Have tested it in windows (VC6) and on linux on arm9 embedded platform.

Original issue reported on code.google.com by stephen....@yahoo.co.uk on 26 Jun 2012 at 4:39

Attachments: