]> git.kaiwu.me - njs.git/commitdiff
HTTP: added support for http/2 and http/3 in r.httpVersion.
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 11 Sep 2020 13:54:57 +0000 (13:54 +0000)
committerDmitry Volyntsev <xeioex@nginx.com>
Fri, 11 Sep 2020 13:54:57 +0000 (13:54 +0000)
nginx/ngx_http_js_module.c

index 98eedfc33d8b80b7558a3a6e28cc3059c27b43fc..e9132fd8baf4ff45c4fbfcdec3082f28f904652a 100644 (file)
@@ -1912,9 +1912,23 @@ ngx_http_js_ext_get_http_version(njs_vm_t *vm, njs_object_prop_t *prop,
         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);