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 2006/03/03 02:29:03 UTC

DO NOT REPLY [Bug 38835] New: - HttpServletRequest.readLine() doesn't block and returns null immediately

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38835>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38835

           Summary: HttpServletRequest.readLine() doesn't block and returns
                    null immediately
           Product: Tomcat 5
           Version: Unknown
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Servlet & JSP API
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: mcamou@mail.com


I am running 5.5.15 but the list doesn't show it (it only shows up to 5.5.14). I have tried this on Linux 
JDK 1.5.0_06 and Mac OS X JDK 1.5.0_05

This is my servlet code pruned of all nonessentials:

package com.tecnoguru.test;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class Test extends HttpServlet {
  public void doGet(HttpServletRequest req, HttpServletResponse res)
          throws ServletException, IOException {
    doIt(req, res);
  }

  public void doPost(HttpServletRequest req, HttpServletResponse res)
          throws ServletException, IOException {
    doIt(req, res);
  }

  public void doIt(HttpServletRequest req, HttpServletResponse res)
          throws ServletException, IOException {
    BufferedReader rdr = req.getReader();
    PrintWriter wrt = res.getWriter();
    String line = rdr.readLine();
    wrt.println(line);
  }
}

This is the result when doing a telnet to port 8080. Note that I did not do anything after the blank line 
in the request, the response started immediately. The lines I typed are prefixed by >, the lines returned 
are prefixed by <:

>telnet localhost 8080
<Trying ::1...
<Connected to localhost.
<Escape character is '^]'.
>GET /Test/test HTTP/1.0
>
<HTTP/1.1 200 OK
<Server: Apache-Coyote/1.1
<Content-Length: 6
<Date: Fri, 03 Mar 2006 01:15:14 GMT
<Connection: close
<
<null
<Connection closed by foreign host.

>telnet localhost 8080
<Trying ::1...
<Connected to localhost.
<Escape character is '^]'.
>POST /Test/test HTTP/1.0
>
<HTTP/1.1 200 OK
<Server: Apache-Coyote/1.1
<Content-Length: 6
<Date: Fri, 03 Mar 2006 01:15:42 GMT
<Connection: close
<
<null
<Connection closed by foreign host.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 38835] - HttpServletRequest.readLine() doesn't block and returns null immediately

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38835>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38835


mcamou@mail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major




-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 38835] - HttpServletRequest.readLine() doesn't block and returns null immediately

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38835>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38835


william.barker@wilshire.com changed:

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




------- Additional Comments From william.barker@wilshire.com  2006-03-03 05:22 -------
You haven't specified either a Content-Length or a Content-Encoding: chunked 
Request header, so Tomcat is correctly believing that the body of the request 
is empty.  So the Reader correctly returns EOF on all attempts to read the 
body.

Running your test case with a Content-Length request header against SVN trunk 
gives me the expected "Read timed out" exception, after it blocks for the 
configured 15sec.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org