fixing compression
This commit is contained in:
parent
f3d020b031
commit
e93779ebf7
Binary file not shown.
|
|
@ -87,21 +87,23 @@ export const createResponse = (
|
|||
}
|
||||
}
|
||||
|
||||
if (opt?.high_compression) {
|
||||
if (!cached && opt.cache_accept.toLowerCase().includes("gz")) {
|
||||
const content_hash = simpleHash(content);
|
||||
if (!g.cache.gz[content_hash]) {
|
||||
g.cache.gz[content_hash] = Bun.gzipSync(content);
|
||||
}
|
||||
if (g.cache.gz[content_hash]) {
|
||||
cached = true;
|
||||
content = g.cache.gz[content_hash];
|
||||
headers["content-encoding"] = "gzip";
|
||||
if (opt.cache_accept.toLowerCase().includes("gz")) {
|
||||
if (opt?.high_compression) {
|
||||
if (!cached) {
|
||||
const content_hash = simpleHash(content);
|
||||
if (!g.cache.gz[content_hash]) {
|
||||
g.cache.gz[content_hash] = Bun.gzipSync(content);
|
||||
}
|
||||
if (g.cache.gz[content_hash]) {
|
||||
cached = true;
|
||||
content = g.cache.gz[content_hash];
|
||||
headers["content-encoding"] = "gzip";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
content = Bun.gzipSync(content);
|
||||
headers["content-encoding"] = "gzip";
|
||||
}
|
||||
} else {
|
||||
content = Bun.gzipSync(content);
|
||||
headers["content-encoding"] = "gzip";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ export const createServer = async () => {
|
|||
const url = new URL(req.url) as URL;
|
||||
url.pathname = url.pathname.replace(/\/+/g, "/");
|
||||
|
||||
|
||||
const prasi = {};
|
||||
const index = prodIndex(g.deploy.config.site_id, prasi);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue