nettylittle-proxy

Calculating size of chunked requests in Netty 4.1 and LittleProxy


I'm currently running an implementation of Netty 4.1 with LittleProxy. I am modifying the code to print out the size of requests coming from the Client to Proxy, I am running into trouble when trying to calculate the size of requests with chunked transfer encoding. I was hoping someone could point me in the right direction where I could calculate determine the size of each chunk as it is received and print it out.


Solution

  • There should be code that handles HttpContent somewhere in LittleProxy. You can get the length of an HTTP chunk from it:

    HttpContent chunk = ...;
    int chunkLength = chunk.content().readableBytes();