You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2017/03/08 10:44:24 UTC

[Bug 60835] New: Inconsistent handling for POST and GET Parameter

https://bz.apache.org/bugzilla/show_bug.cgi?id=60835

            Bug ID: 60835
           Summary: Inconsistent handling for POST and GET Parameter
           Product: Tomcat 8
           Version: 8.5.x-trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: trivial
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: stefan.mocken@congstar.net
  Target Milestone: ----

POST Parameter are nulled when PrintWriter from response.getWriter() is closed,
before request.getParamter("id") is called.

Examlpe:

################################Servlet####################################

public void service(HttpServletRequest request, HttpServletResponse response)
throws Exception {


        PrintWriter wr = response.getWriter();
        wr.write("OK");
        wr.close();


        System.out.println("HTTP Method is: " + request.getMethod() + " " +
request.getParameter("id"));

}

#################################Servlet###################################

################################GET Curl###################################

curl -iv "http://127.0.0.1:8080/test/test?id=123"

################################GET Curl###################################

###############################POST Curl###################################

curl -iv --data "id=123" http://127.0.0.1:8080/test/test

###############################POST Curl###################################

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60835] Inconsistent handling for POST and GET Parameter

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60835

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
This is intentional. See bug 50189 for the details.

I'm struggling to think of a use case where it makes sense not to process the
request body until the response body has been closed. There may be such a use
case but it is going to be rare.

I'm fairly sure this isn't going to be addressed but I want to review the specs
first to see whether WONTFIX or INVALID is the appropriate resolution.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60835] Inconsistent handling for POST and GET Parameter

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60835

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #3 from Mark Thomas <ma...@apache.org> ---
I couldn't find any text in either RFC 7230 (HTTP/1.1) or the Servlet
specification that prohibits reading the request body after the response has
been closed. Therefore, I am resolving this as WONTFIX.

If a use cases emerges we can take a second look. Options at that point would
include:
- user work-around to call getParameter() earlier
- Tomcat parses any POST parameters if the request body is unread when the
input stream is closed

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60835] Inconsistent handling for POST and GET Parameter

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60835

--- Comment #2 from Stefan Mocken <st...@congstar.net> ---
Sure, if any use cases exist they are rare. 

I was just wondering why in this case the parameter handling for GET and POST
is  different.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org