tokers / zstd-nginx-module

Nginx modules for the Zstandard compression
BSD 2-Clause "Simplified" License
196 stars 23 forks source link

Support q=X.Y syntax (quality/weight) and algorithms order #36

Open urusha opened 3 months ago

urusha commented 3 months ago

It seems that nginx never prefers zstd when https://github.com/google/ngx_brotli is also enabled (and brotli's --add-module is specified before zstd's one) and doesn't honor quality. accept-encoding: br, zstd -> content-encoding: br (currently first-specified --add-module algorithm is preferred. add an option for default server-side algorithms order?) accept-encoding: br;q=0.5, zstd;q=1.5 -> content-encoding: br (should be zstd) accept-encoding: gzip;q=1.5, zstd;q=0.5 -> content-encoding: zstd (should be gzip)

nginx version: nginx/1.26.2
built by gcc 12.2.0 (Debian 12.2.0-14) 
built with OpenSSL 3.0.13 30 Jan 2024
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_v3_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -ffile-prefix-map=/root/pkgbuild/deb/nginx-1.26.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie' --add-module=/usr/src/nginx-module-vts --add-module=/usr/src/ngx_http_geoip2_module --add-module=/usr/src/ngx_brotli --add-module=/usr/src/zstd-nginx-module