Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Problem with Chunked Transfer Coding

2005-06-30
2013-05-02
  • Lee Peik Feng
    Lee Peik Feng
    2005-06-30

    Hi,
      I am using clink 170 and having problem with Chunked Transfer Coding.

      According to http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1
      The chunk-size field is a string of hex digits
      But in  HTTPPacket.set(InputStream in, boolean onlyHeaders)

      The following line seems to have problem geting the chunk-size.
      contentLen = Long.parseLong(new String(chunkSizeLine.getBytes(), 0, chunkSizeLine.length()-2));

      I have modified the line as follow:
    contentLen = Long.parseLong(chunkSizeLine, 16);
    and it works properly now.

    Regards,
    Peik Feng

     
    • Satoshi Konno
      Satoshi Konno
      2005-07-06

      Hi Peik,

      Thanks for your bug report.

      I will fix the bug as following.

      contentLen = Long.parseLong(new String(chunkSizeLine.getBytes(), 0, chunkSizeLine.length()-2), 16);

      I will check and fix other bugs for the chunked stream, and
      release as the next minor version with your patch :-)

       
    • Yevgen
      Yevgen
      2005-11-17

      Hi,
      I also met this problem and found solution same as found Lee Peik Feng.

      Why do you cut 'chunkSizeLine' ?
      Java documentation say:
      "
      BufferedReader.readLine() return
      a String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached
      "

      Regards!