[PATCH 1 of 3] HTTP/3: "quic" parameter of "listen" directive

Roman Arutyunyan arut at nginx.com
Tue Feb 7 13:39:55 UTC 2023


Hi,

On Tue, Feb 07, 2023 at 06:12:01AM +0300, Maxim Dounin wrote:
> Hello!
> 
> On Wed, Feb 01, 2023 at 06:01:08PM +0400, Roman Arutyunyan wrote:
> 
> > # HG changeset patch
> > # User Roman Arutyunyan <arut at nginx.com>
> > # Date 1675254688 -14400
> > #      Wed Feb 01 16:31:28 2023 +0400
> > # Branch quic
> > # Node ID 2fcc1c60be1c89aad5464bcc06f1189d1adc885a
> > # Parent  def8e398d7c50131f8dac844814fff729da5c86c
> > HTTP/3: "quic" parameter of "listen" directive.
> > 
> > Now "listen" directve has a new "quic" parameter which enables QUIC protocol
> > for the address.  Further, to enable HTTP/3, a new directive "http3" is
> > introduced.  The hq-interop protocol is enabled by "http3_hq" as before.
> > Now application protocol is chosen by ALPN.
> > 
> > Previously used "http3" parameter of "listen" is deprecated.
> > 
> > diff --git a/README b/README
> > --- a/README
> > +++ b/README
> > @@ -93,13 +93,13 @@ 2. Installing
> >  
> >  3. Configuration
> >  
> > -    The HTTP "listen" directive got a new option "http3" which enables
> > -    HTTP/3 over QUIC on the specified port.
> > +    The HTTP "listen" directive got a new option "quic" which enables
> > +    QUIC as client transport protocol instead of TCP.
> >  
> >      The Stream "listen" directive got a new option "quic" which enables
> >      QUIC as client transport protocol instead of TCP or plain UDP.
> >  
> > -    Along with "http3" or "quic", it's also possible to specify "reuseport"
> > +    Along with "quic", it's also possible to specify "reuseport"
> >      option [8] to make it work properly with multiple workers.
> >  
> >      To enable address validation:
> > @@ -133,12 +133,13 @@ 3. Configuration
> >  
> >      A number of directives were added that configure HTTP/3:
> >  
> > +        http3
> > +        http3_hq
> >          http3_stream_buffer_size
> >          http3_max_concurrent_pushes
> >          http3_max_concurrent_streams
> >          http3_push
> >          http3_push_preload
> > -        http3_hq (requires NGX_HTTP_V3_HQ macro)
> >  
> >      In http, an additional variable is available: $http3.
> >      The value of $http3 is "h3" for HTTP/3 connections,
> > @@ -160,13 +161,15 @@ Example configuration:
> >          server {
> >              # for better compatibility it's recommended
> >              # to use the same port for quic and https
> > -            listen 8443 http3 reuseport;
> > +            listen 8443 quic reuseport;
> >              listen 8443 ssl;
> >  
> >              ssl_certificate     certs/example.com.crt;
> >              ssl_certificate_key certs/example.com.key;
> >              ssl_protocols       TLSv1.3;
> >  
> > +            http3 on;
> > +
> 
> Shouldn't "http3" be "on" by default, so it will be used for all 
> QUIC listening sockets automatically (unless disabled), basically 
> matching the "listen ... http3" behaviour?
> 
> Not sure though, "off" by default seems to better match generic 
> approach and prevents if from being enabled accidentally.  On the 
> other hand, "listen ... quic" has little to no uses without HTTP/3 
> being enabled, and requirement to explicitly enable it looks 
> somewhat silly.

OK, enabled http3 by default.  Indeed, enabling http3 explicitly makes little
sense for most people once "listen ... quic" is specified.

> [...]
> 
> > diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
> > --- a/src/http/ngx_http_core_module.c
> > +++ b/src/http/ngx_http_core_module.c
> > @@ -4191,6 +4191,11 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx
> >  
> >          if (ngx_strcmp(value[n].data, "http3") == 0) {
> >  #if (NGX_HTTP_V3)
> > +            ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
> > +                               "the \"listen ... http3\" directive "
> > +                               "is deprecated, use "
> > +                               "the \"http3\" directive instead");
> 
> Note that this doesn't provide enough information to rewrite the 
> configuration.  Something like "use the \"listen ... quic\" and 
> \"http3\" directives instead" should be better (assuming "http3" 
> is off by default).

Assuming http3 is on by default, this will slightly change then.

> > +            lsopt.quic = 1;
> >              lsopt.http3 = 1;
> >              lsopt.type = SOCK_DGRAM;
> >              continue;
> 
> [...]
> 
> -- 
> Maxim Dounin
> http://mdounin.ru/
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> https://mailman.nginx.org/mailman/listinfo/nginx-devel

--
Roman Arutyunyan


More information about the nginx-devel mailing list