mirror of https://github.com/kiwix/libkiwix.git
Do not compress content smaller than 1400 Bytes
This commit is contained in:
parent
0d294c50a5
commit
fba0f09f4f
|
@ -33,8 +33,15 @@
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
|
// This is somehow a magic value.
|
||||||
#define KIWIX_MIN_CONTENT_SIZE_TO_COMPRESS 100
|
// If this value is too small, we will compress (and lost cpu time) too much
|
||||||
|
// content.
|
||||||
|
// If this value is too big, we will not compress enough content and send too
|
||||||
|
// much data.
|
||||||
|
// If we assume that MTU is 1500 Bytes it is useless to compress
|
||||||
|
// content smaller as the content will be sent in one packet anyway.
|
||||||
|
// 1400 Bytes seems to be a common accepted limit.
|
||||||
|
#define KIWIX_MIN_CONTENT_SIZE_TO_COMPRESS 1400
|
||||||
|
|
||||||
namespace kiwix {
|
namespace kiwix {
|
||||||
|
|
||||||
|
|
|
@ -185,13 +185,10 @@ const ResourceCollection resources200Compressible{
|
||||||
{ WITH_ETAG, "/ROOT/skin/taskbar.css" },
|
{ WITH_ETAG, "/ROOT/skin/taskbar.css" },
|
||||||
{ WITH_ETAG, "/ROOT/skin/block_external.js" },
|
{ WITH_ETAG, "/ROOT/skin/block_external.js" },
|
||||||
|
|
||||||
{ NO_ETAG, "/ROOT/catalog/root.xml" },
|
|
||||||
{ NO_ETAG, "/ROOT/catalog/searchdescription.xml" },
|
|
||||||
{ NO_ETAG, "/ROOT/catalog/search" },
|
{ NO_ETAG, "/ROOT/catalog/search" },
|
||||||
|
|
||||||
{ NO_ETAG, "/ROOT/search?content=zimfile&pattern=a" },
|
{ NO_ETAG, "/ROOT/search?content=zimfile&pattern=a" },
|
||||||
|
|
||||||
{ NO_ETAG, "/ROOT/suggest?content=zimfile" },
|
|
||||||
{ NO_ETAG, "/ROOT/suggest?content=zimfile&term=ray" },
|
{ NO_ETAG, "/ROOT/suggest?content=zimfile&term=ray" },
|
||||||
|
|
||||||
{ NO_ETAG, "/ROOT/catch/external?source=www.example.com" },
|
{ NO_ETAG, "/ROOT/catch/external?source=www.example.com" },
|
||||||
|
@ -224,7 +221,10 @@ const ResourceCollection resources200Uncompressible{
|
||||||
{ WITH_ETAG, "/ROOT/corner_cases/-/empty.css" },
|
{ WITH_ETAG, "/ROOT/corner_cases/-/empty.css" },
|
||||||
{ WITH_ETAG, "/ROOT/corner_cases/-/empty.js" },
|
{ WITH_ETAG, "/ROOT/corner_cases/-/empty.js" },
|
||||||
|
|
||||||
// The title and creator are too small to be compressed
|
// The following url's responses are too small to be compressed
|
||||||
|
{ NO_ETAG, "/ROOT/catalog/root.xml" },
|
||||||
|
{ NO_ETAG, "/ROOT/catalog/searchdescription.xml" },
|
||||||
|
{ NO_ETAG, "/ROOT/suggest?content=zimfile" },
|
||||||
{ WITH_ETAG, "/ROOT/raw/zimfile/meta/Creator" },
|
{ WITH_ETAG, "/ROOT/raw/zimfile/meta/Creator" },
|
||||||
{ WITH_ETAG, "/ROOT/raw/zimfile/meta/Title" },
|
{ WITH_ETAG, "/ROOT/raw/zimfile/meta/Title" },
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue