You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by nacx <gi...@git.apache.org> on 2017/09/21 09:39:34 UTC

[GitHub] incubator-guacamole-client pull request #187: Add a convenience filter to ca...

GitHub user nacx opened a pull request:

    https://github.com/apache/incubator-guacamole-client/pull/187

    Add a convenience filter to cache the contents of HTTP requests

    Some implementations of the HTTP servlet request do not allow a free use of the getInputStream() and getParameter() methods. This is especially annoying in Apache Tomcat >= 7 and Servlet 3.0, where invoking the getParameter() method consumes the InputStream (making later uses of it fail) and consuming the InputStream makes later getParameter() calls fail to find the parameters, as the request body has been consumed.
    
    This causes issues for tunnel servlets that need to access the request parameters, commonly used to pass authentication tokens or additional info provided in the "tunnel.connect()" call, as the tunnel needs later access to the request input stream. Applications using the popular Spring framework may be affected too, since some of its common filters also access the request parameters.
    
    This PR adds a convenience filter that caches the request contents to allow free access to its body and parameters, so servlets and filters can access the request information normally. Without this caching, if the request parameters are accessed in the tunnel servlet or a previous filter, the `doWrite` method in the base HTTP tunnel servlet always gets an already consumed InputStream and does not write anything to the socket, causing an eventual timeout in the client.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/nacx/incubator-guacamole-client cached-request

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-guacamole-client/pull/187.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #187
    
----
commit 30d4e74088c3a4330887803501dd3db13fea658e
Author: Ignasi Barrera <na...@apache.org>
Date:   2017-09-21T09:24:08Z

    Add the GuacamoleHTTPCachingFilter
    
    Some implementations of the HTTP servlet request do not allow a free use
    of the getInputStream() and getParameter() methods. This is especially
    annoying in Apache Tomcat >= 7 and Servlet 3.0, where invoking the
    getParameter() method consumes the InputStream (making later uses of it
    fail) and consuming the InputStream makes later getParameter() calls
    fail to find the parameters, as the request body has been consumed.
    
    This causes issues for tunnel servlets that need to access the request
    parameters, commonly used to pass authentication tokens or additional
    info provided in the "tunnel.connect()" call, as the tunnel needs later
    access to the request input stream. Applications using the popular
    Spring framework may be affected too, since some of its common filters
    also access the request parameters.
    
    This commit adds a convenience filter that caches the request contents
    to allow free access to its body and parameters, so servlets and filters
    can access the request information normally.

----


---

[GitHub] incubator-guacamole-client pull request #187: GUACAMOLE-385: Add a convenien...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-guacamole-client/pull/187


---