You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/07/31 08:52:51 UTC

[GitHub] [incubator-apisix] taotao2014 commented on a change in pull request #1953: add core.request.get_scheme/host/port/http_version

taotao2014 commented on a change in pull request #1953:
URL: https://github.com/apache/incubator-apisix/pull/1953#discussion_r463488169



##########
File path: apisix/core/request.lua
##########
@@ -94,7 +94,34 @@ function _M.get_remote_client_port(ctx)
         ctx = ngx.ctx.api_ctx
     end
     return tonumber(ctx.var.remote_port)
-  end
+end
+
+function _M.get_scheme(ctx)
+    if not ctx then
+        ctx = ngx.ctx.api_ctx
+    end
+    return ctx.var.scheme or ''
+end
+
+function _M.get_host(ctx)
+    if not ctx then
+        ctx = ngx.ctx.api_ctx
+    end
+    return ctx.var.host or ''
+end
+
+function _M.get_port(ctx)
+    if not ctx then
+        ctx = ngx.ctx.api_ctx
+    end
+    return tonumber(ctx.var.server_port)
+end
+
+function _M.get_http_version()

Review comment:
       Method is better




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org