HTTP.jl icon indicating copy to clipboard operation
HTTP.jl copied to clipboard

How to log size of incoming request?

Open jkrumbiegel opened this issue 3 years ago • 2 comments

  • Julia 1.7.3
  • HTTP.jl 1

The logging function supplied with HTTP.jl checks the stream.nwritten field to log the size of the data sent out.

https://github.com/JuliaWeb/HTTP.jl/blob/master/src/Streams.jl#L16

But I would like to also log what the size of the data coming in was. At the time when the logging function is called, the other field ntoread is always 0, which points to it being a state variable that is 0 once the whole incoming message has been read.

How would I correctly get the size of the received message? I've considered looking at stream.message.body but I'm not sure if that's the way to go.

jkrumbiegel avatar Jul 25 '22 10:07 jkrumbiegel

You can perhaps log the incoming ContentLength header for now.

fredrikekre avatar Jul 25 '22 10:07 fredrikekre

I will have a look at that, thank you.

jkrumbiegel avatar Jul 25 '22 12:07 jkrumbiegel