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 2011/06/09 09:54:08 UTC

DO NOT REPLY [Bug 51346] New: When RequestDumperValve is enabled, an attempt to read from InputStream from an application is failing

https://issues.apache.org/bugzilla/show_bug.cgi?id=51346

             Bug #: 51346
           Summary: When RequestDumperValve is enabled, an attempt to read
                    from InputStream from an application is failing
           Product: Tomcat 6
           Version: 6.0.32
          Platform: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: violetagg@apache.org
    Classification: Unclassified


Created attachment 27136
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27136
test-input-stream web application

Hello,

I have an application that tries to get InputStream and to read from it.
Without RequestDumperValve everything is OK.
When I enable RequestDumperValve it appears that the InputStream is already
read and the end of stream is reached.

How to reproduce:
1.Deploy the attached test-input-stream.war.
2.Use the attached TestClient that will send a POST request.
3.In the console you will see "in.read() != -1" which is OK
4.Enable the RequestDumperValve in the server.xml
5.Use again the attached TestClient that will send a POST request.
6.In the console you will see "in.read() == -1" which is true when the end of
stream is reached.

What TestClient does:
- sends POST request via HttpURLConnection
- writes to the OutputStream

My suspicious is that RequestDumperValve wants to dump the parameters, but
parsing the parameters operation will read InputStream.

Can you give me advice how to proceed.

Thanks in advance.
Regards
Violeta

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 51346] When RequestDumperValve is enabled, an attempt to read from InputStream from an application is failing

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

Pid <bu...@pidster.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #27139|0                           |1
        is obsolete|                            |

--- Comment #12 from Pid <bu...@pidster.com> 2011-06-09 19:50:36 UTC ---
Created attachment 27142
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27142
corrected patch for docs

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 51346] When RequestDumperValve is enabled, an attempt to read from InputStream from an application is failing

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

--- Comment #14 from violetagg@apache.org 2011-06-14 14:17:47 UTC ---
(In reply to comment #13)
> Modified patch applied (the updated patch still ignored the content-type) to
> 6.0.x and will be included in 6.0.33 onwards.

Thanks!

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 51346] When RequestDumperValve is enabled, an attempt to read from InputStream from an application is failing

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

--- Comment #8 from Pid <bu...@pidster.com> 2011-06-09 12:38:52 UTC ---
Done.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 51346] When RequestDumperValve is enabled, an attempt to read from InputStream from an application is failing

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

--- Comment #10 from Pid <bu...@pidster.com> 2011-06-09 19:44:46 UTC ---
(In reply to comment #9)
> That statements in the patch are incorrect. The inputstream is only consumed
> when a) the request is a POST and b) the request content type is
> "application/x-www-form-urlencoded"

Doh.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 51346] When RequestDumperValve is enabled, an attempt to read from InputStream from an application is failing

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #13 from Mark Thomas <ma...@apache.org> 2011-06-14 13:46:44 UTC ---
Modified patch applied (the updated patch still ignored the content-type) to
6.0.x and will be included in 6.0.33 onwards.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 51346] When RequestDumperValve is enabled, an attempt to read from InputStream from an application is failing

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

--- Comment #1 from violetagg@apache.org 2011-06-09 07:55:13 UTC ---
Created attachment 27137
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27137
TestClient

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 51346] When RequestDumperValve is enabled, an attempt to read from InputStream from an application is failing

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

--- Comment #7 from Pid <bu...@pidster.com> 2011-06-09 12:38:37 UTC ---
Created attachment 27139
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27139
Patch for the docs page on valves, including more info about RDV behaviour.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 51346] When RequestDumperValve is enabled, an attempt to read from InputStream from an application is failing

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

violetagg@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |

--- Comment #3 from violetagg@apache.org 2011-06-09 10:36:09 UTC ---
(In reply to comment #2)
> (In reply to comment #1)
> > Created attachment 27137 [details]
> > TestClient
> Yes, the valve dumps headers, parameters causing the InputStream to be
> consumed:
> http://svn.apache.org/repos/asf/tomcat/sandbox/comet/java/org/apache/catalina/valves/RequestDumperValve.java
> The users list is where to ask for help, rather than bugzilla.

Yes but don't you think that this is a problem?
Typically you can use this Valve for debugging your application:

"* ...It is especially useful in debugging problems
 * related to headers and cookies."

But what happens actually is that your application will stop working because of
this valve.

Is it possible at least to document this behavior?

Thanks
Violeta

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 51346] When RequestDumperValve is enabled, an attempt to read from InputStream from an application is failing

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

Pid <bu...@pidster.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #27138|0                           |1
        is obsolete|                            |

--- Comment #11 from Pid <bu...@pidster.com> 2011-06-09 19:50:11 UTC ---
Created attachment 27141
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27141
corrected patch

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 51346] When RequestDumperValve is enabled, an attempt to read from InputStream from an application is failing

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

--- Comment #5 from violetagg@apache.org 2011-06-09 10:55:30 UTC ---
(In reply to comment #4)
> (In reply to comment #3)
> > "* ...It is especially useful in debugging problems
> >  * related to headers and cookies."
> The JavaDoc that you are citing above does not have the warning,
> but the documentation does have it,
> http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html#Request_Dumper_Valve

The page contains the following:
"WARNING: Using this valve has side-effects. The output from this valve
includes any parameters included with the request. The parameters will be
decoded using the default platform encoding. Any subsequent calls to
request.setCharacterEncoding() within the web application will have no effect.
"

There is no explicit note for inputstream consumption which actually happens.

I can propose a patch if you think it is applicable, but this will take some
time.

What do you think?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 51346] When RequestDumperValve is enabled, an attempt to read from InputStream from an application is failing

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

--- Comment #6 from Pid <bu...@pidster.com> 2011-06-09 12:30:54 UTC ---
Created attachment 27138
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27138
Patch for RDV javadoc including a warning.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 51346] When RequestDumperValve is enabled, an attempt to read from InputStream from an application is failing

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

--- Comment #9 from Mark Thomas <ma...@apache.org> 2011-06-09 19:28:30 UTC ---
That statements in the patch are incorrect. The inputstream is only consumed
when a) the request is a POST and b) the request content type is
"application/x-www-form-urlencoded"

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 51346] When RequestDumperValve is enabled, an attempt to read from InputStream from an application is failing

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

--- Comment #4 from Konstantin Kolinko <kn...@gmail.com> 2011-06-09 10:49:14 UTC ---
(In reply to comment #3)
> "* ...It is especially useful in debugging problems
>  * related to headers and cookies."

The JavaDoc that you are citing above does not have the warning,

but the documentation does have it,
http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html#Request_Dumper_Valve

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 51346] When RequestDumperValve is enabled, an attempt to read from InputStream from an application is failing

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

Pid <bu...@pidster.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID
         OS/Version|                            |All

--- Comment #2 from Pid <bu...@pidster.com> 2011-06-09 09:37:43 UTC ---
(In reply to comment #1)
> Created attachment 27137 [details]
> TestClient

Yes, the valve dumps headers, parameters causing the InputStream to be
consumed:
http://svn.apache.org/repos/asf/tomcat/sandbox/comet/java/org/apache/catalina/valves/RequestDumperValve.java

The users list is where to ask for help, rather than bugzilla.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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