Fix makefile

This commit is contained in:
2021-05-04 22:36:29 +02:00
parent 80986325ce
commit ffbbcc6490
2 changed files with 10 additions and 6 deletions

View File

@ -3,7 +3,7 @@ CFLAGS=-std=c11 -Wall
INCLUDE=-lssl -lcrypto -lmagic -lz -lmaxminddb -lbrotlienc
LIBS=src/lib/*.c
DEBIAN_OPTS=-D MAGIC_FILE="\"/usr/share/file/magic.mgc\"" -D PHP_FPM_SOCKET="\"/var/run/php/php7.3-fpm.sock\""
DEBIAN_OPTS=-D CACHE_MAGIC_FILE="\"/usr/share/file/magic.mgc\"" -D PHP_FPM_SOCKET="\"/var/run/php/php7.3-fpm.sock\""
packages:
@echo "Installing packages..."

View File

@ -407,10 +407,14 @@ int client_request_handler(sock *client, unsigned long client_num, unsigned int
char *accept_encoding = http_get_header_field(&req.hdr, "Accept-Encoding");
char *content_type = http_get_header_field(&res.hdr, "Content-Type");
char *content_encoding = http_get_header_field(&res.hdr, "Content-Encoding");
if (mime_is_compressible(content_type) && content_encoding == NULL &&
accept_encoding != NULL && strstr(accept_encoding, "deflate") != NULL) {
http_add_header_field(&res.hdr, "Content-Encoding", "deflate");
use_fastcgi = 2;
if (mime_is_compressible(content_type) && content_encoding == NULL && accept_encoding != NULL) {
if (strstr(accept_encoding, "br") != NULL) {
http_add_header_field(&res.hdr, "Content-Encoding", "br");
use_fastcgi = FASTCGI_COMPRESS_BR;
} else if (strstr(accept_encoding, "gzip") != NULL) {
http_add_header_field(&res.hdr, "Content-Encoding", "gzip");
use_fastcgi = FASTCGI_COMPRESS_GZ;
}
}
if (http_get_header_field(&res.hdr, "Content-Length") == NULL) {
@ -508,7 +512,7 @@ int client_request_handler(sock *client, unsigned long client_num, unsigned int
} else if (use_fastcgi) {
char *transfer_encoding = http_get_header_field(&res.hdr, "Transfer-Encoding");
int chunked = transfer_encoding != NULL && strcmp(transfer_encoding, "chunked") == 0;
int flags = (chunked ? FASTCGI_CHUNKED : 0) | ((use_fastcgi == 2) ? FASTCGI_COMPRESS : 0);
int flags = (chunked ? FASTCGI_CHUNKED : 0) | (use_fastcgi & FASTCGI_COMPRESS);
fastcgi_send(&php_fpm, client, flags);
} else if (use_rev_proxy) {
char *transfer_encoding = http_get_header_field(&res.hdr, "Transfer-Encoding");