#9 Smaller buffer size(s) while reading HTTP messages



attached is another patch against the trunk where http://sourceforge.net/tracker/?func=detail&aid=3054219&group_id=75638&atid=544608 has already been applied.

This patch restricts the buffer size used for reading HTTP messages to Content-Length in case it is set and smaller than the HTTP.getChunkSize(). The latter is 512kb which resulted in growing the heap on android for every HTTP message that was read (which can happen quite often). I also restricted the buffer size of the BufferedReader used to read the HTTP Header values to 512 which is a lot smaller than the 16k that are allocated by default (and is sufficiently big). The last fix contained is for the multicast socket were closing and reading from it can cause a NPE while shutting down a control point. Before reading from the socket, it is now checked whether it has already been closed and if so an exception is thrown. However, this does not fix the real reason why HTTPMUSocket.receive() is called after the socket has been closed.



  • Satoshi Konno

    Satoshi Konno - 2010-10-25
    • status: open --> closed
  • Satoshi Konno

    Satoshi Konno - 2010-10-25

    Hi Stephan,

    I have added the your patches into the trunk repository now.

    2010-10-26 Stephan Mehlhase
    * Fixed HTTPMUSocket::receive() to throw exception when the socket is closed.
    * Changed HTTPHeader::getValue() to set the max value size.
    * Changed HTTPPackat::set() to set applicable buffer size.

    Please tell me if you want to add your changes into the repository as
    the developer :-)

    Best Regards,

    Satoshi Konno