[njs] HTTP: added support for http/2 and http/3 in r.httpVersion.

Dmitry Volyntsev xeioex at nginx.com
Fri Sep 11 13:57:44 UTC 2020


details:   https://hg.nginx.org/njs/rev/e1dccc5a2f05
branches:  
changeset: 1522:e1dccc5a2f05
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Fri Sep 11 13:54:57 2020 +0000
description:
HTTP: added support for http/2 and http/3 in r.httpVersion.

diffstat:

 nginx/ngx_http_js_module.c |  16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r f8c8e23d2bbd -r e1dccc5a2f05 nginx/ngx_http_js_module.c
--- a/nginx/ngx_http_js_module.c	Mon Sep 07 17:55:24 2020 +0300
+++ b/nginx/ngx_http_js_module.c	Fri Sep 11 13:54:57 2020 +0000
@@ -1912,9 +1912,23 @@ ngx_http_js_ext_get_http_version(njs_vm_
         ngx_str_set(&v, "1.0");
         break;
 
-    default: /* NGX_HTTP_VERSION_11 */
+    case NGX_HTTP_VERSION_11:
         ngx_str_set(&v, "1.1");
         break;
+
+    case NGX_HTTP_VERSION_20:
+        ngx_str_set(&v, "2.0");
+        break;
+
+#if (NGX_HTTP_VERSION_30)
+    case NGX_HTTP_VERSION_30:
+        ngx_str_set(&v, "3.0");
+        break;
+#endif
+
+    default:
+        ngx_str_set(&v, "");
+        break;
     }
 
     return njs_vm_value_string_set(vm, retval, v.data, v.len);


More information about the nginx-devel mailing list