On Fri, 2018-04-20 at 14:31 +0200, Philippe Mouawad wrote:
> On Fri, Apr 20, 2018 at 1:01 PM, Oleg Kalnichevski <oleg@ok2consultin
> g.com>
> wrote:
> 
> > On Fri, 2018-04-20 at 11:40 +0200, Philippe Mouawad wrote:
> > > Hello Oleg,
> > > Thanks for rapid answer.
> > > The body size including entity.
> > > 
> > 
> > 
> > Should this number represent raw bytes (including the size of
> > transfer
> > encoding elements)
> 
> 
> Can you illustrate so that I am sure to understand what you mean by
> size of
> transfer
> encoding elements ?
> 

---
HTTP/1.1 200 OK\r\n
Content-Length: 5\r\n
\r\n
stuff
---

total message length: 43
raw content length: 5 
content length: 5 

---
HTTP/1.1 200 OK\r\n
Transfer-Encoding: chunked\r\n
\r\n
5\r\n
stuff0\r\n
\r\
n
---

total message length: 60
raw content length: 16 
content length: 5 

What number are you after?

Oleg


> 
> > or content bytes only (same of Content-Length when
> > present)?
> > 
> 
> 
> 
> > 
> > It would be much easier if you took the size of the entire message.
> > 
> 
> How should I proceed ?
> 
> > 
> > Oleg
> > 
> > 
> > 
> > > I'd like the header size to be aside, I already know how to
> > > compute
> > > header
> > > size.
> > > 
> > > Regards
> > > 
> > > 
> > > On Fri, Apr 20, 2018 at 11:21 AM, Oleg Kalnichevski <olegk@apache
> > > .org
> > > > 
> > > 
> > > wrote:
> > > 
> > > > On Fri, 2018-04-20 at 11:09 +0200, Philippe Mouawad wrote:
> > > > > Hello ,
> > > > > 
> > > > > In current Live version of JMeter we use this way of
> > > > > computing
> > > > > size
> > > > > of
> > > > > responses for each request:
> > > > > 
> > > > >    -
> > > > >    https://github.com/apache/jmeter/blob/v4_0/src/protocol/ht
> > > > > tp/o
> > > > > rg/a
> > > > > pache/jmeter/protocol/http/sampler/HTTPHC4Impl.java#L888
> > > > > 
> > > > > 
> > > > > As we migrated to last APIs we based implementation on this
> > > > > SO
> > > > > response
> > > > > from Oleg:
> > > > > 
> > > > >    -
> > > > >    https://stackoverflow.com/questions/26166469/measure-bandw
> > > > > idth
> > > > > -usa
> > > > > ge-with-apache-httpcomponents-httpclient
> > > > > 
> > > > > And ended up with this:
> > > > > 
> > > > >    -
> > > > >    https://github.com/apache/jmeter/blob/trunk/src/protocol/h
> > > > > ttp/
> > > > > org/
> > > > > apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java#L382
> > > > > 
> > > > > But it appears that computation is wrong and we would need to
> > > > > do
> > > > > this
> > > > > to be
> > > > > correct:
> > > > > 
> > > > >         protected HttpResponse doReceiveResponse(
> > > > >                 final HttpRequest request,
> > > > >                 final HttpClientConnection conn,
> > > > >                 final HttpContext context) throws
> > > > > HttpException,
> > > > > IOException {
> > > > >             HttpResponse response =
> > > > > super.doReceiveResponse(request,
> > > > > conn,
> > > > > context);
> > > > >             HttpConnectionMetrics metrics =
> > > > > conn.getMetrics();
> > > > >             HttpEntity entity = response.getEntity();
> > > > >             context.setAttribute(CONTEXT_ATTRIBUTE_RECEIVED_B
> > > > > YTES
> > > > > ,
> > > > >                     metrics.getReceivedBytesCount()+
> > > > >                     (entity != null ?
> > > > > entity.getContentLength():
> > > > > 0L));
> > > > >             metrics.reset();
> > > > >             return response;
> > > > >         }
> > > > > 
> > > > 
> > > > Philippe
> > > > 
> > > > Are you trying to calculate the size of an entire response
> > > > (message
> > > > head + message entity body) or a response entity only?
> > > > 
> > > > Oleg
> > > > 
> > > > > 
> > > > > Is my understanding correct ? or am I missing something ?
> > > > > 
> > > > > Thanks
> > > > > 
> > > > > Regards
> > > > 
> > > > -------------------------------------------------------------
> > > > ----
> > > > ----
> > > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.
> > > > org
> > > > For additional commands, e-mail: httpclient-users-help@hc.apach
> > > > e.or
> > > > g
> > > > 
> > > > 
> > > 
> > > 
> > 
> > -----------------------------------------------------------------
> > ----
> > To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
> > For additional commands, e-mail: httpclient-users-h...@hc.apache.or
> > g
> > 
> > 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org

Reply via email to