#34 Multipart not parsed successfuly

Bug (26)

The attached file is not being parsed successfully parsing blows up at BoundaryConsumer.scan(Byte[]) it throws IOException("Invalid boundary");



  • Anonymous

    There are two problems:

    1- between the last boundary-end and the boundary-end before it there are two "\r\n" while boundary consumer assumes there is one.

    2- there are no \r\n at the end of the file this will cause an infinite loop.

    Regarding the first point I'll look at the HTTP rfc and see if this standard or a bug, but for point two I think its a bug.


  • Anonymous

    I figured out the reason of these bugs:

    1- Infinite loop is caused because the consumers keep looping while their finished conditions are not met or cursor.isReady() remain true but none of the consumers seem to take into consideration the Content-length as a factor.

    2- The second is caused because PartListConsumer starts off directly by calling the boundary consume method without taking into consideration that some time their will be garbage character between a part boundary and another.

    this is the assumption that is causing problems:

    Instead boundary should consume everything to the end of the body (based on content-length) or untill it hits another boundary.

  • If you could write a test case for the loop that would be great!!