main/nginx: add slowfs_cache module

This commit is contained in:
Michael Pirogov 2023-03-15 17:20:52 +03:00 committed by Jakub Jirutka
parent a70b8be0ef
commit 5ee4a6460b
2 changed files with 72 additions and 1 deletions

View file

@ -37,7 +37,7 @@ pkgname=nginx
# NOTE: Upgrade only to even-numbered versions (e.g. 1.14.z, 1.16.z)!
# Odd-numbered versions are mainline (development) versions.
pkgver=1.26.0
pkgrel=0
pkgrel=1
# Revision of nginx-tests to use for check().
_tests_hgrev=22f45bf99a9e
_njs_ver=0.8.4
@ -106,6 +106,7 @@ source="https://nginx.org/download/nginx-$pkgver.tar.gz
nginx-upload-module~fixes.patch
nginx-upload-module~fix-nginx-compat.patch
zstd-nginx-module~fix-infinite-loop.patch
ngx_slowfs_cache~nginx-1.8.x-compat.patch
nginx.conf
default.conf
stream.conf
@ -232,6 +233,9 @@ _http_set_misc_depends="$pkgname-mod-devel-kit"
_add_module "http-shibboleth" "v2.0.2" "https://github.com/nginx-shib/nginx-http-shibboleth"
_add_module "http-slowfs-cache" "1.11" "https://github.com/dvershinin/ngx_slowfs_cache"
_http_slowfs_cache_so="ngx_http_slowfs_module.so"
_add_module "http-untar" "v1.1" "https://github.com/ajax16384/ngx_http_untar_module"
_add_module "http-upload" "2.3.0" "https://github.com/fdintino/nginx-upload-module"
@ -520,6 +524,7 @@ abda15727e34178db2f8013a1c47e480ba323a3b3b88a44bbada0169b8ce66743911ec7b551272fc
ef57603bd65ffbbb216fd748dab0126d3df7aafdfa70dce0ea9ef91373df95269546ec2fcaa03f842a8db3a16879274184a23b18db17b4f9be3916aedacb7765 nginx-upload-module~fixes.patch
bae6c3153810bf6f460248668f2c48e332aba37081e25e45a1691344508530ef1be9acee4d52f506cb09510c4fce8d93ca3178ba45af771c54e37126f4f11b1b nginx-upload-module~fix-nginx-compat.patch
97ed3a3ad636a8853a993db3a33c67da303063e7ac43c20eeac6afb9f71adafa5dedf5f5f8c6705a256294c0566e3ac9f5fa41930048ad80b10a7d2a7d3c9b53 zstd-nginx-module~fix-infinite-loop.patch
f3bddaea6a52917d57a3cac84a90ca3951e09b976b69dba2ee7559d64f52b781ab13185d9fac18af1abdbfffd80561167a391d7e2fc73e04104444e5cc9f82b0 ngx_slowfs_cache~nginx-1.8.x-compat.patch
c209a220b6afc9354a1c4c39817199327425485b3da44778d632cdfd1d95b8412c58ba9b27a5c96599e7a34cc039f5b7d914ad82153c610b27dfbe21fdcdca77 nginx.conf
0907f69dc2d3dc1bad3a04fb6673f741f1a8be964e22b306ef9ae2f8e736e1f5733a8884bfe54f3553fff5132a0e5336716250f54272c3fec2177d6ba16986f3 default.conf
426f0c317322af7cab152f2070398c7aa5c059276ba504617a212f1e060bbb1dd9edc54e62d4cf5f14e3678235351c808ebeabe8b122757c74b3f505e8427106 stream.conf
@ -548,6 +553,7 @@ d7aac69b5eceeb1b0db4741201159ade1e0e7f6f7c3e8c4afa2f8959c6c00c3b5285d5185747c2fb
d6ca250db8de93edbd7875afca35e73cecdaf82132d1a7ee933cf94c6b8afa8e629e9e647a9321f2bc1fbb92137ec0d32dcd89b82ac5fae31e342537fb7e0431 redis2-nginx-module-0.15.tar.gz
1ff4c947538a5bd5f9d6adcd87b37f2702f5cc90e3342bc08359cbe8f290b705a3a2daa3dedfb1df3ce4bc19478c8fcac07081c4a53a804fc2862d50078278dc set-misc-nginx-module-0.33.tar.gz
0f0c5167e999ffad0caa816d4b7d0a121f0598d578391834fe3293a3e023453d91b36ffc32a431ff3af3f9f376d2d78703998560094d20643b4049c2fec84bda nginx-http-shibboleth-2.0.2.tar.gz
3ace47ec7b93af1cbe513ee1c98c51ca7c14bb1824e1d70c0718b6279125fb34451cd41983ef384ea1549685779cba31c4f514f1c48c1fe90e80174b33269e97 ngx_slowfs_cache-1.11.tar.gz
c3a7dd29c4a4e47d396b19622a290a04d4cceb97c1b8a508bc984eb8c81d17da4bf5789514bb996987f8343bc801ee4457a86a274bde98b49a809afdfc04cbde ngx_http_untar_module-1.1.tar.gz
a0da355888398f86a6b5d065e58c05f9e057589ee785be9f515d77d7a020ae5a7b0656f5af30fb3b026f457326db2e26f4fed29026221ec5fc8156ef8586da25 nginx-upload-module-2.3.0.tar.gz
c31c46344d49704389722325a041b9cd170fa290acefe92cfc572c07f711cd3039de78f28df48ca7dcb79b2e4bbe442580aaaf4d92883fd3a14bf41d66dd9d8c nginx-upload-progress-module-0.9.2.tar.gz

View file

@ -0,0 +1,65 @@
--- a/ngx_http_slowfs_module.c 2013-03-07 17:01:55.000000000 +0400
+++ b/ngx_http_slowfs_module.c 2023-03-13 13:34:38.294577255 +0300
@@ -62,6 +62,12 @@
ngx_int_t ngx_http_slowfs_cache_status(ngx_http_request_t *,
ngx_http_variable_value_t *, uintptr_t);
+static void * ngx_http_slowfs_create_main_conf(ngx_conf_t *cf);
+
+typedef struct {
+ ngx_array_t caches; /* ngx_http_file_cache_t * */
+} ngx_http_slowfs_main_conf_t;
+
typedef struct {
ngx_flag_t enabled;
ngx_shm_zone_t *cache;
@@ -108,8 +114,8 @@
{ ngx_string("slowfs_cache_path"),
NGX_HTTP_MAIN_CONF|NGX_CONF_2MORE,
ngx_http_file_cache_set_slot,
- 0,
- 0,
+ NGX_HTTP_MAIN_CONF_OFFSET,
+ offsetof(ngx_http_slowfs_main_conf_t, caches),
&ngx_http_slowfs_module },
{ ngx_string("slowfs_cache_min_uses"),
@@ -156,7 +162,7 @@
ngx_http_slowfs_add_variables, /* preconfiguration */
ngx_http_slowfs_init, /* postconfiguration */
- NULL, /* create main configuration */
+ ngx_http_slowfs_create_main_conf, /* create main configuration */
NULL, /* init main configuration */
NULL, /* create server configuration */
@@ -1170,6 +1176,29 @@
return NGX_OK;
}
+static void *
+ngx_http_slowfs_create_main_conf(ngx_conf_t *cf)
+{
+ ngx_http_slowfs_main_conf_t *conf;
+
+ conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_slowfs_main_conf_t));
+ if (conf == NULL) {
+ return NULL;
+ }
+
+#if (NGX_HTTP_CACHE)
+ if (ngx_array_init(&conf->caches, cf->pool, 4,
+ sizeof(ngx_http_file_cache_t *))
+ != NGX_OK)
+ {
+ return NULL;
+ }
+#endif
+
+ return conf;
+}
+
+
#else /* !NGX_HTTP_CACHE */