JDK-5051200 : chunked encoding is not ended by a zero-size chunk
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • OS: generic
  • CPU: generic
  • Submitted: 2004-05-21
  • Updated: 2004-06-16
  • Resolved: 2004-05-24
Related Reports
Relates :  
Description

Name: vpR10197			Date: 05/21/2004


--------------------------------------                                                                                   
Test        : http/HttpStreaming/Chunked/chunked002
VM          : ClientVM, ServerVM
Mode        : all
Platform    : all
OS          : all
JDK         : since tiger-b50
----------------------------------------                                                                                 
The test sets chunked streaming mode, sends to the Http server specified
amount of bytes and expects the server to receive the same amount.
It works with its own Http server which implements POST request method.

The "3.6.1 Chunked Transfer Coding" section of RFC2616 says:

    "The chunked encoding is ended by any chunk whose size is
    zero, followed by the trailer, which is terminated by an empty line."

Data reading on the server side is implemeted as it is recommended by 
the "19.4.6 Introduction of Transfer-Encoding" section of RFC2616.
But no zero-size chunk is received during waiting time that is 1 min.
Note this time is specified by command line parameters and hardcoded into
launching script(run.sh).

To reproduce the failure:
   cd /net/jano.sfbay/export/disk20/GammaBase/Bugs/<this bug number>
   sh run.sh $JAVA_HOME [-g] [JAVA_OPTS]
where
     -g  - run test with java_g binaries

Here is an example of test's output:
    Settings:
            totalBytes = 12
            bufferSize = 10
            waitTime = 1
    HTTP-client>Starting default Http-server
    waiting server to be start
    sending 12 bytes
    Server started
    HTTP version: HTTP/1.1
    User-Agent: Java/1.5.0-beta2
    Host: localhost:8080
    Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
    Connection: keep-alive
    Content-type: application/x-www-form-urlencoded
    Transfer-Encoding: chunked

    receiving data
    data = 0123456
    chunk size = 7
    data = 78901
    chunk size = 5
    ***ERR***> WaitTime is expired.
            Server was not correctly finished.
    TEST FAILED

======================================================================

Comments
EVALUATION Sending the zero sized chunk at the end is handled internally. The application is supposed to just write the data to the stream and call close() when finished. This test is not calling close(). So I don't think there is a bug here. ###@###.### 2004-05-24
24-05-2004