Hello wise ones,
I'm exercising me on LWP and HTTP::* modules writing a tool
aiming to timing the response of the webserver in detail.
The tool is htmlpage orientented; meaning that I will consider and discern the different elements constituing the html page resulting from the request. IE I will time separately the reception of the body and the content included in it.
I was in first approch relaing on the content_lenght header but I found it was not received from every webserver so (now the questions):
1) can I safely assume that
$size_body = length ($response->content) ?
Now start the confusion:
length says: "Returns the length in
characters of the value of EXPR." while the
camel book states: "Returns the length in bytes of the scalar value val.".
Following this little difference I discovered the
bytes pragma (in this page I learned that
chr(400) is one character but two bytes) and new question born:
2)Considering now I'm working with unpredictable html output I have to do this esoteric operation counting the bytes I receive back
$size_body = bytes::length ($response->content)? and:
3)I have to consider also the content type and the encoding (returned in headers) to calculate the more accurate size in bytes (as definetively data come to me in bytes over the network..) of the response content?
4)to be accurate I have to time and size the response code and the message received back before headers, then headers, then the body and also (the response code and message too?) of any embedded element in the page?
thanks for the attention and for eventual answers
Lor*
there are no rules, there are no thumbs..