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=37794>.
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=37794

           Summary: getParameter() fails on POST with transfer-encoding:
                    chunked
           Product: Tomcat 5
           Version: 5.5.12
          Platform: PC
        OS/Version: Windows 2000
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Servlet & JSP API
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


Overview: When an HTTP/1.1 client (for example J2ME) POST with
transfer-encoding: chunked to a servlet, the getParameter() family and
getQueryString() methods fail to retrieve the correct result by returning
nothing. In contrast, reading until end-of-file on the servlets input stream
produces correct result.

Steps to reproduce: Send a chunked POST request, with a=0 in the first chunk,
sleep 1 s, then send &b=0 in the next, followed by a 0-chunk and trailer. On the
receiving servlet, call getParameterNames() or getParameter().

Actual Results: null

Expected results: a=0&b=1

Build: Tomcat 5.5.12

Additional Builds and Platforms:
- getParameter() does fail on:
    Tomcat 4.1.18
    Tomcat 4.1.24
    Tomcat 5.5.12
- getParameter() doesn't fail on:
    Jetty 5.1.6

Additional Information: Please refer to the log below for Tomcat behaviour. It
is from a simple test client and servlet written to demonstrate the bug.
Tomcat 5.5.12 log:

****************************
1) Reading the body - PASS *
****************************
    [junit] // testChunked(localhost, 8080)
    [junit] // Sending request to host localhost port 8080
    [junit] POST /testchunked/EchoServlet/getBody HTTP/1.1
    [junit] User-Agent: no.riiber.net.http.test.chunked.EchoClient 
(chunked-test)
    [junit] content-type: application/x-www-form-urlencoded
    [junit] connection: Close
    [junit] host: localhost:8080
    [junit] transfer-encoding: chunked

    [junit] 3
    [junit] a=0
    [junit] 4
    [junit] &b=1
    [junit] // Reading response from host localhost port 8080
    [junit] HTTP/1.1 200 OK
    [junit] Server: Apache-Coyote/1.1
    [junit] Content-Type: text/plain;charset=ISO-8859-1
    [junit] Content-Length: 9
    [junit] Date: Mon, 05 Dec 2005 07:48:59 GMT
    [junit] Connection: close

    [junit] a=0&b=1
    [junit] // PASS: a=0
    [junit] // PASS: &b=1
***************************************
2) Reading using getQuerySTring: FAILS
***************************************
    [junit] // testChunked(localhost, 8080)
    [junit] // Sending request to host localhost port 8080
    [junit] POST /testchunked/EchoServlet/getQueryString HTTP/1.1
    [junit] User-Agent: no.riiber.net.http.test.chunked.EchoClient 
(chunked-test)
    [junit] content-type: application/x-www-form-urlencoded
    [junit] connection: Close
    [junit] host: localhost:8080
    [junit] transfer-encoding: chunked

    [junit] 3
    [junit] a=0
    [junit] 4
    [junit] &b=1
    [junit] // Reading response from host localhost port 8080
    [junit] HTTP/1.1 200 OK
    [junit] Server: Apache-Coyote/1.1
    [junit] Content-Type: text/plain;charset=ISO-8859-1
    [junit] Content-Length: 6
    [junit] Date: Mon, 05 Dec 2005 07:48:59 GMT
    [junit] Connection: close

    [junit] null
    [junit] // *** FAIL: a=0 is not present in response from
/testchunked/EchoServlet/getQueryString ***
    [junit] // *** FAIL: &b=1 is not present in response from
/testchunked/EchoServlet/getQueryString ***
********************************************
3) Reading using getParameterNames(): FAILS
*********************************************
    [junit] // testChunked(localhost, 8080)
    [junit] // Sending request to host localhost port 8080
    [junit] POST /testchunked/EchoServlet/getParameterNamesAndValues HTTP/1.1
    [junit] User-Agent: no.riiber.net.http.test.chunked.EchoClient 
(chunked-test)
    [junit] content-type: application/x-www-form-urlencoded
    [junit] connection: Close
    [junit] host: localhost:8080
    [junit] transfer-encoding: chunked

    [junit] 3
    [junit] a=0
    [junit] 4
    [junit] &b=1
    [junit] // Reading response from host localhost port 8080
    [junit] HTTP/1.1 200 OK
    [junit] Server: Apache-Coyote/1.1
    [junit] Content-Type: text/plain;charset=ISO-8859-1
    [junit] Content-Length: 2
    [junit] Date: Mon, 05 Dec 2005 07:49:02 GMT
    [junit] Connection: close


    [junit] // *** FAIL: a=0 is not present in response from
/testchunked/EchoServlet/getParameterNamesAndValues ***
    [junit] // *** FAIL: &b=1 is not present in response from
/testchunked/EchoServlet/getParameterNamesAndValues ***

Best regards
Arne Riiber

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to