разные значения fastcgi cache valid для разных запросов

2021-11-23 Thread alex123456
Привет! 
использую fastcgi_cache в nginx.
появилась необходимость кешировать разные запросы на разное время
столкнулся с тем что в директиву  fastcgi_cache_valid нельзя передать
переменную

 if ($request_uri ~* "/(api/1|api/2)")
{
   set $no_cache 0;
   set $cache_valid 5m;
}
...

fastcgi_cache_valid 200 $cache_valid; // так будет ошибка

fastcgi_cache_valid 200 1m; // так сраблотает

Подскажите какие может есть варианты реализации разного времени жизни кэша?

Posted at Nginx Forum: 
https://forum.nginx.org/read.php?21,292932,292932#msg-292932

___
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru

Re: [PATCH] HTTP/2: fixed sendfile() aio handling

2021-11-23 Thread Maxim Dounin
Hello!

On Tue, Nov 23, 2021 at 10:44:00AM +0300, Sergey Kandaurov wrote:

> > On 23 Nov 2021, at 06:12, Maxim Dounin  wrote:
> > 
> > On Thu, Nov 18, 2021 at 07:46:48PM +0300, Sergey Kandaurov wrote:
> > 
> >>> On 16 Nov 2021, at 17:41, Maxim Dounin  wrote:
> >>> 
> >>> On Tue, Nov 16, 2021 at 02:59:46PM +0300, Sergey Kandaurov wrote:
> >>> 
> > On 11 Nov 2021, at 06:10, Maxim Dounin  wrote:
> > 
> > # HG changeset patch
> > # User Maxim Dounin 
> > # Date 1636599377 -10800
> > #  Thu Nov 11 05:56:17 2021 +0300
> > # Node ID 76e072a6947a221868705c13973de15319c0d921
> > # Parent  82b750b20c5205d685e59031247fe898f011394e
> > HTTP/2: fixed sendfile() aio handling.
> > 
> > With sendfile() in threads ("aio threads; sendfile on;"), client 
> > connection
> > can block on writing, waiting for sendfile() to complete.  In HTTP/2 
> > this
> > might result in the request hang, since an attempt to continue processig
>  
>  processing
> >>> 
> >>> Fixed, thnx.
> >>> 
> > in thread event handler will call request's write event handler, which
> > is usually stopped by ngx_http_v2_send_chain(): it does nothing if there
> > are no additional data and stream->queued is set.  Further, HTTP/2 
> > resets
> > stream's c->write->ready to 0 if writing blocks, so just fixing
> > ngx_http_v2_send_chain() is not enough.
> > 
> > Can be reproduced with test suite on Linux with:
> > 
> > TEST_NGINX_GLOBALS_HTTP="aio threads; sendfile on;" prove h2*.t
> > 
> > The following tests currently fail: h2_keepalive.t, h2_priority.t,
> > h2_proxy_max_temp_file_size.t, h2.t, h2_trailers.t.
> > 
> > Similarly, sendfile() with AIO preloading on FreeBSD can block as well,
> > with similar results.  This is, however, harder to reproduce, especially
> > on modern FreeBSD systems, since sendfile() usually do not return EBUSY.
>  
>  does not
> >>> 
> >>> Fixed, thnx.
> >>> 
> > Fix is to post a write event on HTTP/2 connection in the thread event
> > handler (and aio preload handler).  This ensures that sendfile() will be
> > completed and stream processing will be resumed by HTTP/2 code.
> > 
> > diff --git a/src/http/ngx_http_copy_filter_module.c 
> > b/src/http/ngx_http_copy_filter_module.c
> > --- a/src/http/ngx_http_copy_filter_module.c
> > +++ b/src/http/ngx_http_copy_filter_module.c
> > @@ -250,6 +250,21 @@ ngx_http_copy_aio_sendfile_event_handler
> >   r->aio = 0;
> >   ev->complete = 0;
> > 
> > +#if (NGX_HTTP_V2)
> > +
> > +if (r->stream) {
> > +/*
> > + * for HTTP/2, trigger a write event on the main connection
> > + * to handle sendfile() preload
> > + */
> > +
> > +ngx_post_event(r->stream->connection->connection->write,
> > +   _posted_events);
> > +return;
> > +}
> > +
> > +#endif
> > +
> >   r->connection->write->handler(r->connection->write);
> > }
> > 
> > @@ -323,6 +338,20 @@ ngx_http_copy_thread_event_handler(ngx_e
> >   r->main->blocked--;
> >   r->aio = 0;
> > 
> > +#if (NGX_HTTP_V2)
> > +
> > +if (r->stream) {
> > +/*
> > + * for HTTP/2, trigger a write event on the main connection
> > + * to handle sendfile() in threads
> > + */
> > +
> > +ngx_post_event(r->stream->connection->connection->write,
> > +   _posted_events);
> > +}
> > +
> > +#endif
> > +
> > 
> > [...]
> > 
> > For the record, while testing this patch Sergey found another 
> > issue with sendfile() in threads and HTTP/2: since HTTP/2 might 
> > call sendfile() within the main connection, bypassing request 
> > filter chain, normal r->aio flag checking to prevent multiple 
> > operations do not work, and this eventually results in "task 
> > already active" alerts due to duplicate operations being posted.  
> > With the above patch this issue is much more likely to happen, 
> > since it intentionally triggers write events on the main HTTP/2 
> > connection.
> > 
> > Below are two patches: the first one addresses the issue with 
> > duplicate operations by additionally checking file->thread_task 
> > before sendfile(), and the second one is a better alternative to 
> > the above patch which doesn't post additional events on the main 
> > connection.
> > 
> > # HG changeset patch
> > # User Maxim Dounin 
> > # Date 1637635671 -10800
> > #  Tue Nov 23 05:47:51 2021 +0300
> > # Node ID 8a18b0bff1266db221fe35dc08f4483044ea0f86
> > # Parent  82b750b20c5205d685e59031247fe898f011394e
> > HTTP/2: fixed "task already active" with sendfile in threads.
> > 
> > With sendfile in threads, "task already active" alerts might appear in logs
> > if a write event happens on the main HTTP/2 

Re: how Can I Cross Compile nginx web server for arm linux?

2021-11-23 Thread Francis Daly
On Tue, Nov 23, 2021 at 12:11:00AM -0500, vrezaei wrote:

Hi there,

> I have solved my problem by following instructions precisely.
>  https://programmer.help/blogs/cross-compiling-nginx-used-on-hi3536.html
> it is a  very good tutorial.

Great that you found a recipe that compiles this version for you!

All the best,

f
-- 
Francis Dalyfran...@daoine.org
___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


Re: Enabling lua in Nginx 1.18.0

2021-11-23 Thread Francis Daly
On Tue, Nov 23, 2021 at 02:37:37PM +, BELUCHE Yannick wrote:

Hi there,

> $> nginx -t
> nginx: [emerg] unknown directive "access_by_lua" in 
> /etc/nginx/nginx-lua-headers.conf:91

That form of message means that the matching module is not present in the 
running nginx.

> However it seems by typing nginx -V that the http-lua module is installed :
> 
> $> nginx -V 2>1& | tr ' ' '\n'
n
> --add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-lua

"dynamic" means that at configure time, that module was set to be built
as a thing that can be loaded at run-time.

But until it actually is loaded, it is not present in the running nginx.

See http://nginx.org/r/load_module

> the weird thing is that I did the same thing on an older version of Ubuntu 
> (Xenial - 16.04.2 LTS) (ie: apt install nginx nginx-extras) and the directive 
> "access_by_lua" works out of the box on it...
> 

Maybe the older version included a "load_module" directive that the newer 
version does not?

Good luck with it,

f
-- 
Francis Dalyfran...@daoine.org
___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


RE: Enabling lua in Nginx 1.18.0

2021-11-23 Thread Thomas Ward
I misread your version sorry.  This needs a bug filed in Ubuntu as I think the 
Lua module being 'loaded' doesnt necessarily mean it works.  Unless someone has 
an easy fix for you, its possible this is a bug in that nginx version/lua 
module in the reposSent from my T-Mobile 5G Device
 Original message From: BELUCHE Yannick 
 Date: 11/23/21  09:38  (GMT-05:00) To: 
nginx@nginx.org Subject: Enabling lua in Nginx 1.18.0 

Hello,
 
I installed Nginx and Nginx-extra on an Ubuntu Focal 20.04.2 LTS server. I 
wanted to use access_by_lua directive and I got an error :

$> nginx –t
nginx: [emerg] unknown directive “access_by_lua” in 
/etc/nginx/nginx-lua-headers.conf:91
 
However it seems by typing nginx –V that the http-lua module is installed :

 
$> nginx –V 2>1& | tr ' ' '\n'
nginx
version:
nginx/1.18.0
(Ubuntu)
built
with
OpenSSL
1.1.1f

31
Mar
2020
TLS
SNI
support
enabled
configure
arguments:
--with-cc-opt='-g
-O2
-fdebug-prefix-map=/build/nginx-KTLRnK/nginx-1.18.0=.
-fstack-protector-strong
-Wformat
-Werror=format-security
-fPIC
-Wdate-time
-D_FORTIFY_SOURCE=2'
--with-ld-opt='-Wl,-Bsymbolic-functions
-Wl,-z,relro
-Wl,-z,now
-fPIC'
--prefix=/usr/share/nginx
--conf-path=/etc/nginx/nginx.conf
--http-log-path=/var/log/nginx/access.log
--error-log-path=/var/log/nginx/error.log
--lock-path=/var/lock/nginx.lock
--pid-path=/run/nginx.pid
--modules-path=/usr/lib/nginx/modules
--http-client-body-temp-path=/var/lib/nginx/body
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi
--http-proxy-temp-path=/var/lib/nginx/proxy
--http-scgi-temp-path=/var/lib/nginx/scgi
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi
--with-debug
--with-compat
--with-pcre-jit
--with-http_ssl_module
--with-http_stub_status_module
--with-http_realip_module
--with-http_auth_request_module
--with-http_v2_module
--with-http_dav_module
--with-http_slice_module
--with-threads
--with-http_addition_module
--with-http_flv_module
--with-http_geoip_module=dynamic
--with-http_gunzip_module
--with-http_gzip_static_module
--with-http_image_filter_module=dynamic
--with-http_mp4_module
--with-http_perl_module=dynamic
--with-http_random_index_module
--with-http_secure_link_module
--with-http_sub_module
--with-http_xslt_module=dynamic
--with-mail=dynamic
--with-mail_ssl_module
--with-stream=dynamic
--with-stream_ssl_module
--with-stream_ssl_preread_module
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-headers-more-filter
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-auth-pam
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-cache-purge
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-dav-ext
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-ndk
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-echo
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-fancyindex
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/nchan
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-lua
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/rtmp
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-uploadprogress
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-upstream-fair
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-subs-filter
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-geoip2
 
the weird thing is that I did the same thing on an older version of Ubuntu 
(Xenial – 16.04.2 LTS) (ie: apt install nginx nginx-extras) and the directive 
“access_by_lua” works out of the box on it…
 
Can someone please help me with that ?
 
Thanks in advance!
Regards,
 
Yannick



___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

RE: Enabling lua in Nginx 1.18.0

2021-11-23 Thread Thomas Ward
nginx upstream has nothing to do with the NGINX packages in Ubuntu.The Lua 
module in Ubuntu was removed and dropped by the Server Team's decision that 
supporting it requires excess work into the future that they were not willing 
to support as well as additional modules like resty core just to make Lua 
work.You need to go and install OpenResty's nginx fork and modules to get Lua 
in ubuntu 20.04.  Also, the Lua module is not maintained by NGINX either.Sent 
from my T-Mobile 5G Device
 Original message From: BELUCHE Yannick 
 Date: 11/23/21  09:38  (GMT-05:00) To: 
nginx@nginx.org Subject: Enabling lua in Nginx 1.18.0 

Hello,
 
I installed Nginx and Nginx-extra on an Ubuntu Focal 20.04.2 LTS server. I 
wanted to use access_by_lua directive and I got an error :

$> nginx –t
nginx: [emerg] unknown directive “access_by_lua” in 
/etc/nginx/nginx-lua-headers.conf:91
 
However it seems by typing nginx –V that the http-lua module is installed :

 
$> nginx –V 2>1& | tr ' ' '\n'
nginx
version:
nginx/1.18.0
(Ubuntu)
built
with
OpenSSL
1.1.1f

31
Mar
2020
TLS
SNI
support
enabled
configure
arguments:
--with-cc-opt='-g
-O2
-fdebug-prefix-map=/build/nginx-KTLRnK/nginx-1.18.0=.
-fstack-protector-strong
-Wformat
-Werror=format-security
-fPIC
-Wdate-time
-D_FORTIFY_SOURCE=2'
--with-ld-opt='-Wl,-Bsymbolic-functions
-Wl,-z,relro
-Wl,-z,now
-fPIC'
--prefix=/usr/share/nginx
--conf-path=/etc/nginx/nginx.conf
--http-log-path=/var/log/nginx/access.log
--error-log-path=/var/log/nginx/error.log
--lock-path=/var/lock/nginx.lock
--pid-path=/run/nginx.pid
--modules-path=/usr/lib/nginx/modules
--http-client-body-temp-path=/var/lib/nginx/body
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi
--http-proxy-temp-path=/var/lib/nginx/proxy
--http-scgi-temp-path=/var/lib/nginx/scgi
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi
--with-debug
--with-compat
--with-pcre-jit
--with-http_ssl_module
--with-http_stub_status_module
--with-http_realip_module
--with-http_auth_request_module
--with-http_v2_module
--with-http_dav_module
--with-http_slice_module
--with-threads
--with-http_addition_module
--with-http_flv_module
--with-http_geoip_module=dynamic
--with-http_gunzip_module
--with-http_gzip_static_module
--with-http_image_filter_module=dynamic
--with-http_mp4_module
--with-http_perl_module=dynamic
--with-http_random_index_module
--with-http_secure_link_module
--with-http_sub_module
--with-http_xslt_module=dynamic
--with-mail=dynamic
--with-mail_ssl_module
--with-stream=dynamic
--with-stream_ssl_module
--with-stream_ssl_preread_module
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-headers-more-filter
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-auth-pam
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-cache-purge
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-dav-ext
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-ndk
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-echo
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-fancyindex
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/nchan
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-lua
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/rtmp
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-uploadprogress
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-upstream-fair
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-subs-filter
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-geoip2
 
the weird thing is that I did the same thing on an older version of Ubuntu 
(Xenial – 16.04.2 LTS) (ie: apt install nginx nginx-extras) and the directive 
“access_by_lua” works out of the box on it…
 
Can someone please help me with that ?
 
Thanks in advance!
Regards,
 
Yannick



___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Enabling lua in Nginx 1.18.0

2021-11-23 Thread BELUCHE Yannick
Hello,

I installed Nginx and Nginx-extra on an Ubuntu Focal 20.04.2 LTS server. I 
wanted to use access_by_lua directive and I got an error :
$> nginx -t
nginx: [emerg] unknown directive "access_by_lua" in 
/etc/nginx/nginx-lua-headers.conf:91

However it seems by typing nginx -V that the http-lua module is installed :

$> nginx -V 2>1& | tr ' ' '\n'
nginx
version:
nginx/1.18.0
(Ubuntu)
built
with
OpenSSL
1.1.1f

31
Mar
2020
TLS
SNI
support
enabled
configure
arguments:
--with-cc-opt='-g
-O2
-fdebug-prefix-map=/build/nginx-KTLRnK/nginx-1.18.0=.
-fstack-protector-strong
-Wformat
-Werror=format-security
-fPIC
-Wdate-time
-D_FORTIFY_SOURCE=2'
--with-ld-opt='-Wl,-Bsymbolic-functions
-Wl,-z,relro
-Wl,-z,now
-fPIC'
--prefix=/usr/share/nginx
--conf-path=/etc/nginx/nginx.conf
--http-log-path=/var/log/nginx/access.log
--error-log-path=/var/log/nginx/error.log
--lock-path=/var/lock/nginx.lock
--pid-path=/run/nginx.pid
--modules-path=/usr/lib/nginx/modules
--http-client-body-temp-path=/var/lib/nginx/body
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi
--http-proxy-temp-path=/var/lib/nginx/proxy
--http-scgi-temp-path=/var/lib/nginx/scgi
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi
--with-debug
--with-compat
--with-pcre-jit
--with-http_ssl_module
--with-http_stub_status_module
--with-http_realip_module
--with-http_auth_request_module
--with-http_v2_module
--with-http_dav_module
--with-http_slice_module
--with-threads
--with-http_addition_module
--with-http_flv_module
--with-http_geoip_module=dynamic
--with-http_gunzip_module
--with-http_gzip_static_module
--with-http_image_filter_module=dynamic
--with-http_mp4_module
--with-http_perl_module=dynamic
--with-http_random_index_module
--with-http_secure_link_module
--with-http_sub_module
--with-http_xslt_module=dynamic
--with-mail=dynamic
--with-mail_ssl_module
--with-stream=dynamic
--with-stream_ssl_module
--with-stream_ssl_preread_module
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-headers-more-filter
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-auth-pam
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-cache-purge
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-dav-ext
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-ndk
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-echo
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-fancyindex
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/nchan
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-lua
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/rtmp
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-uploadprogress
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-upstream-fair
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-subs-filter
--add-dynamic-module=/build/nginx-KTLRnK/nginx-1.18.0/debian/modules/http-geoip2

the weird thing is that I did the same thing on an older version of Ubuntu 
(Xenial - 16.04.2 LTS) (ie: apt install nginx nginx-extras) and the directive 
"access_by_lua" works out of the box on it...

Can someone please help me with that ?

Thanks in advance!
Regards,

Yannick
___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

nginx-quic :authority header not passed to $http_host

2021-11-23 Thread Underverse Underverse
When using http3 there's no $http_host variable, as there's no Host: 
header but :authority pseudo-header which is not passed to any $http_ 
variable. How I can get contents of :authority pseudo-header to pass it 
to my backend?


___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[nginx] SSL: $ssl_curve (ticket #2135).

2021-11-23 Thread Sergey Kandaurov
details:   https://hg.nginx.org/nginx/rev/3443c02ca1d1
branches:  
changeset: 7973:3443c02ca1d1
user:  Sergey Kandaurov 
date:  Mon Nov 01 18:09:34 2021 +0300
description:
SSL: $ssl_curve (ticket #2135).

The variable contains a negotiated curve used for the handshake key
exchange process.  Known curves are listed by their names, unknown
ones are shown in hex.

Note that for resumed sessions in TLSv1.2 and older protocols,
$ssl_curve contains the curve used during the initial handshake,
while in TLSv1.3 it contains the curve used during the session
resumption (see the SSL_get_negotiated_group manual page for
details).

The variable is only meaningful when using OpenSSL 3.0 and above.
With older versions the variable is empty.

diffstat:

 src/event/ngx_event_openssl.c  |  36 ++
 src/event/ngx_event_openssl.h  |   2 +
 src/http/modules/ngx_http_ssl_module.c |   3 ++
 src/stream/ngx_stream_ssl_module.c |   3 ++
 4 files changed, 44 insertions(+), 0 deletions(-)

diffs (84 lines):

diff -r 284f03d6f154 -r 3443c02ca1d1 src/event/ngx_event_openssl.c
--- a/src/event/ngx_event_openssl.c Tue Nov 23 12:52:43 2021 +0300
+++ b/src/event/ngx_event_openssl.c Mon Nov 01 18:09:34 2021 +0300
@@ -4734,6 +4734,42 @@ ngx_ssl_get_ciphers(ngx_connection_t *c,
 
 
 ngx_int_t
+ngx_ssl_get_curve(ngx_connection_t *c, ngx_pool_t *pool, ngx_str_t *s)
+{
+#ifdef SSL_get_negotiated_group
+
+int  nid;
+
+nid = SSL_get_negotiated_group(c->ssl->connection);
+
+if (nid != NID_undef) {
+
+if ((nid & TLSEXT_nid_unknown) == 0) {
+s->len = ngx_strlen(OBJ_nid2sn(nid));
+s->data = (u_char *) OBJ_nid2sn(nid);
+return NGX_OK;
+}
+
+s->len = sizeof("0x") - 1;
+
+s->data = ngx_pnalloc(pool, s->len);
+if (s->data == NULL) {
+return NGX_ERROR;
+}
+
+ngx_sprintf(s->data, "0x%04xd", nid & 0x);
+
+return NGX_OK;
+}
+
+#endif
+
+s->len = 0;
+return NGX_OK;
+}
+
+
+ngx_int_t
 ngx_ssl_get_curves(ngx_connection_t *c, ngx_pool_t *pool, ngx_str_t *s)
 {
 #ifdef SSL_CTRL_GET_CURVES
diff -r 284f03d6f154 -r 3443c02ca1d1 src/event/ngx_event_openssl.h
--- a/src/event/ngx_event_openssl.h Tue Nov 23 12:52:43 2021 +0300
+++ b/src/event/ngx_event_openssl.h Mon Nov 01 18:09:34 2021 +0300
@@ -256,6 +256,8 @@ ngx_int_t ngx_ssl_get_cipher_name(ngx_co
 ngx_str_t *s);
 ngx_int_t ngx_ssl_get_ciphers(ngx_connection_t *c, ngx_pool_t *pool,
 ngx_str_t *s);
+ngx_int_t ngx_ssl_get_curve(ngx_connection_t *c, ngx_pool_t *pool,
+ngx_str_t *s);
 ngx_int_t ngx_ssl_get_curves(ngx_connection_t *c, ngx_pool_t *pool,
 ngx_str_t *s);
 ngx_int_t ngx_ssl_get_session_id(ngx_connection_t *c, ngx_pool_t *pool,
diff -r 284f03d6f154 -r 3443c02ca1d1 src/http/modules/ngx_http_ssl_module.c
--- a/src/http/modules/ngx_http_ssl_module.cTue Nov 23 12:52:43 2021 +0300
+++ b/src/http/modules/ngx_http_ssl_module.cMon Nov 01 18:09:34 2021 +0300
@@ -342,6 +342,9 @@ static ngx_http_variable_t  ngx_http_ssl
 { ngx_string("ssl_ciphers"), NULL, ngx_http_ssl_variable,
   (uintptr_t) ngx_ssl_get_ciphers, NGX_HTTP_VAR_CHANGEABLE, 0 },
 
+{ ngx_string("ssl_curve"), NULL, ngx_http_ssl_variable,
+  (uintptr_t) ngx_ssl_get_curve, NGX_HTTP_VAR_CHANGEABLE, 0 },
+
 { ngx_string("ssl_curves"), NULL, ngx_http_ssl_variable,
   (uintptr_t) ngx_ssl_get_curves, NGX_HTTP_VAR_CHANGEABLE, 0 },
 
diff -r 284f03d6f154 -r 3443c02ca1d1 src/stream/ngx_stream_ssl_module.c
--- a/src/stream/ngx_stream_ssl_module.cTue Nov 23 12:52:43 2021 +0300
+++ b/src/stream/ngx_stream_ssl_module.cMon Nov 01 18:09:34 2021 +0300
@@ -269,6 +269,9 @@ static ngx_stream_variable_t  ngx_stream
 { ngx_string("ssl_ciphers"), NULL, ngx_stream_ssl_variable,
   (uintptr_t) ngx_ssl_get_ciphers, NGX_STREAM_VAR_CHANGEABLE, 0 },
 
+{ ngx_string("ssl_curve"), NULL, ngx_stream_ssl_variable,
+  (uintptr_t) ngx_ssl_get_curve, NGX_STREAM_VAR_CHANGEABLE, 0 },
+
 { ngx_string("ssl_curves"), NULL, ngx_stream_ssl_variable,
   (uintptr_t) ngx_ssl_get_curves, NGX_STREAM_VAR_CHANGEABLE, 0 },
 
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[nginx] Version bump.

2021-11-23 Thread Sergey Kandaurov
details:   https://hg.nginx.org/nginx/rev/284f03d6f154
branches:  
changeset: 7972:284f03d6f154
user:  Sergey Kandaurov 
date:  Tue Nov 23 12:52:43 2021 +0300
description:
Version bump.

diffstat:

 src/core/nginx.h |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (14 lines):

diff -r 82b750b20c52 -r 284f03d6f154 src/core/nginx.h
--- a/src/core/nginx.h  Tue Nov 02 17:49:22 2021 +0300
+++ b/src/core/nginx.h  Tue Nov 23 12:52:43 2021 +0300
@@ -9,8 +9,8 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define nginx_version  1021004
-#define NGINX_VERSION  "1.21.4"
+#define nginx_version  1021005
+#define NGINX_VERSION  "1.21.5"
 #define NGINX_VER  "nginx/" NGINX_VERSION
 
 #ifdef NGX_BUILD
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel