Skip to content

Commit 01727a3

Browse files
r--wagentzh
authored andcommitted
feature: added HTTP 2.0 support to ngx.req.http_version().
1 parent 4f29543 commit 01727a3

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

README.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3946,7 +3946,7 @@ ngx.req.http_version
39463946

39473947
Returns the HTTP version number for the current request as a Lua number.
39483948

3949-
Current possible values are 1.0, 1.1, and 0.9. Returns `nil` for unrecognized values.
3949+
Current possible values are 2.0, 1.0, 1.1, and 0.9. Returns `nil` for unrecognized values.
39503950

39513951
This method was first introduced in the `v0.7.17` release.
39523952

doc/HttpLuaModule.wiki

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3258,7 +3258,7 @@ See also [[#ngx.now|ngx.now]] and [[#ngx.update_time|ngx.update_time]].
32583258
32593259
Returns the HTTP version number for the current request as a Lua number.
32603260
3261-
Current possible values are 1.0, 1.1, and 0.9. Returns <code>nil</code> for unrecognized values.
3261+
Current possible values are 2.0, 1.0, 1.1, and 0.9. Returns <code>nil</code> for unrecognized values.
32623262
32633263
This method was first introduced in the <code>v0.7.17</code> release.
32643264

src/ngx_http_lua_headers.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ ngx_http_lua_ngx_req_http_version(lua_State *L)
5353
lua_pushnumber(L, 1.1);
5454
break;
5555

56+
#ifdef NGX_HTTP_VERSION_20
57+
case NGX_HTTP_VERSION_20:
58+
lua_pushnumber(L, 2.0);
59+
break;
60+
#endif
61+
5662
default:
5763
lua_pushnil(L);
5864
break;

0 commit comments

Comments
 (0)