diff --git a/docs/source/concepts/resource_tree.rst b/docs/source/concepts/resource_tree.rst index 2179abe..2ae044f 100644 --- a/docs/source/concepts/resource_tree.rst +++ b/docs/source/concepts/resource_tree.rst @@ -101,6 +101,28 @@ then, when handling the request: kapow.example +``/request/version`` Resource +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The HTTP version of the incoming request. + +Sample Usage +^^^^^^^^^^^^ + +If the user runs: + +.. code-block:: console + + $ curl --http1.0 http://kapow.example:8080 + +then, when handling the request: + +.. code-block:: console + + $ kapow get /request/version + HTTP/1.0 + + ``/request/path`` Resource ~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -123,6 +145,28 @@ then, when handling the request: /foo/bar +``/request/remote`` Resource +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The IP address of the host making the incoming request. + +Sample Usage +^^^^^^^^^^^^ + +If the user runs: + +.. code-block:: console + + $ curl http://kapow.example:8080 + +then, when handling the request: + +.. code-block:: console + + $ kapow get /request/remote + 192.168.100.156 + + ``/request/matches/`` Resource ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/internal/server/data/server.go b/internal/server/data/server.go index 2cba06a..f5f131e 100644 --- a/internal/server/data/server.go +++ b/internal/server/data/server.go @@ -59,7 +59,9 @@ func Run(bindAddr string, wg *sync.WaitGroup) { // request {"/handlers/{handlerID}/request/method", "GET", getRequestMethod}, {"/handlers/{handlerID}/request/host", "GET", getRequestHost}, + {"/handlers/{handlerID}/request/version", "GET", getRequestVersion}, {"/handlers/{handlerID}/request/path", "GET", getRequestPath}, + {"/handlers/{handlerID}/request/remote", "GET", getRequestRemote}, {"/handlers/{handlerID}/request/matches/{name}", "GET", getRequestMatches}, {"/handlers/{handlerID}/request/params/{name}", "GET", getRequestParams}, {"/handlers/{handlerID}/request/headers/{name}", "GET", getRequestHeaders},