计算 HTTPS POST 请求大小

发布于 2024-10-07 14:12:29 字数 327 浏览 0 评论 0原文

我有一个将数据发送到 servlet 的中间件。

有人知道如何计算servlet中中间件的请求大小吗?

我正在尝试计算请求标头+请求大小+证书大小的总和 正确吗?

有了这个,我尝试重新创建请求:

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

宣告ˉ结束 2024-10-14 14:12:29

我很确定没有简单的方法。

事实上,我什至不确定这是否是一个有意义的衡量指标。请求头和请求体是HTTP应用协议的一部分。在 HTTP 内容开始之前,证书作为 SSL / TLS 设置的一部分发送。一旦 SSL / TLS 启动,HTTP 协议就会在 SSL / TLS 通道“之上”运行。

即使只是测量 HTTP 请求中的数据量也是很棘手的。典型的 HTTP 堆栈不会将整个请求消息组装在一处,并且不会保留发送的数据量的运行总数。根据您使用的 HTTP 堆栈,您可以(理论上)安排使用自定义套接字工厂和对发送的字节进行计数的套接字流。

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.

未央 2024-10-14 14:12:29

阅读有关 SSL 握手

我认为对话往返可能会让您担心以及数据包大小。

一旦握手阶段完成并且连接被重用(保持活动),仅发送 HTTP 数据,当然是加密的。

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.

中二柚 2024-10-14 14:12:29

像这样:

$值){
$size += (strlen($key) + strlen($value) + 3);
}
printf("大小=%d",$size);
出口;
?>

like this:

$value) {
$size += (strlen($key) + strlen($value) + 3);
}
printf("size=%d",$size);
exit;
?>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文