Question

I have a middlet that sends data to a servlet.

Anyone knows how can I calculate the size of request of the middlet in a servlet?

I'm tring to sum of request header + request size + certificate size Is it correct?

With this I'm trying to recreate the request:

http://wikis.sun.com/display/WebServerdocs/Analyzing+SSL+Requests+and+Responses

Was it helpful?

Solution

I'm pretty sure that there is no simple way.

In fact, I'm not even sure this is a meaningful thing to measure. The request header and body are part of the HTTP application protocol. The certificate is sent as part of SSL / TLS setup ... before the HTTP stuff starts. And once SSL / TLS has started, the HTTP protocol is run "on top of" the SSL / TLS channel.

Even just measuring the amount of data in a HTTP request is tricky. A typical HTTP stack does not assemble the entire request message in one place, and does not keep a running total of the amount of data sent. Depending on the HTTP stack that you are using, you could (in theory) arrange to use a custom socket factory and socket streams that count the bytes sent.

OTHER TIPS

Read more about SSL handshake:

I think the conversation round-trip may worry you as well as packet sizes.

Once handshake phase is finished and connection is reused (keepalive) only HTTP data is sent, encrypted of course.

like this:

$value) { $size += (strlen($key) + strlen($value) + 3); } printf("size=%d",$size); exit; ?>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top