分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 技术分享

httpstat的简单使用

发布时间:2023-09-06 02:15责任编辑:白小东关键词:http

httpstat 应该是一个 python 封装后的 curl 工具能够展现 一些客户端连接网站的时间消耗,最近在看tls 感觉挺有用处的 简单学习一下

1. centos7 安装python 和 pip

yum intall python -y#安装pythoncurl https://bootstrap.pypa.io/get-pip.py -o get-pip.py#下载pip安装文件python get-pip.py#安装pip

2. 安装httpstat模块

pip install httpstat

3. 检测一下连接信息等

命令和结果分别为

httpstat www.ibm.comConnected to 221.230.145.189:80 from 10.24.101.161:60064HTTP/1.1 301 Moved PermanentlyServer: GHostContent-Length: 0Location: https://www.ibm.com/Date: Fri, 22 Sep 2018 06:51:03 GMTConnection: keep-aliveX-Content-Type-Options: nosniffX-XSS-Protection: 1; mode=blockContent-Security-Policy: upgrade-insecure-requestsBody stored in: /tmp/tmpUz7t3D ?DNS Lookup ??TCP Connection ??Server Processing ??Content Transfer[ ??5515ms ??| ?????46ms ?????| ??????51ms ???????| ???????0ms ??????] ????????????| ???????????????| ??????????????????| ?????????????????| ???namelookup:5515ms ????????| ??????????????????| ?????????????????| ???????????????????????connect:5561ms ???????????| ?????????????????| ?????????????????????????????????????starttransfer:5612ms ??????????| ????????????????????????????????????????????????????????????????total:5612ms 

百度的结果为:

httpstat www.baidu.comConnected to 115.239.210.27:80 from 10.24.101.161:41492HTTP/1.1 200 OKAccept-Ranges: bytesCache-Control: private, no-cache, no-store, proxy-revalidate, no-transformConnection: Keep-AliveContent-Length: 2381Content-Type: text/htmlDate: Fri, 22 Sep 2018 06:50:22 GMTEtag: "58860504-94d"Last-Modified: Mon, 23 Jan 2017 13:28:36 GMTPragma: no-cacheServer: bfe/1.0.8.18Set-Cookie: BDORZ=27315; max-age=86400; domain=.baidu.com; path=/Body stored in: /tmp/tmpcavbBI ?DNS Lookup ??TCP Connection ??Server Processing ??Content Transfer[ ???28ms ???| ?????60ms ?????| ??????60ms ???????| ???????0ms ??????] ????????????| ???????????????| ??????????????????| ?????????????????| ???namelookup:28ms ??????????| ??????????????????| ?????????????????| ???????????????????????connect:88ms ?????????????| ?????????????????| ?????????????????????????????????????starttransfer:148ms ???????????| ????????????????????????????????????????????????????????????????total:148ms ?

需要指定是 https 还是 http 不然 走的貌似不是一个 如下面。

格式坏了 将就着看吧

[root@centos75master ~]# httpstat https://www.baidu.com
Connected to 115.239.210.27:443 from 10.24.101.161:50884

HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
Connection: Keep-Alive
Content-Length: 2443
Content-Type: text/html
Date: Fri, 21 Sep 2018 08:16:09 GMT
Etag: "58860429-98b"
Last-Modified: Mon, 23 Jan 2017 13:24:57 GMT
Pragma: no-cache
Server: bfe/1.0.8.18
Set-Cookie: BDORZ=27315; max-age=86400; domain=.baidu.com; path=/

Body stored in: /tmp/tmpkUm2PH

?DNS Lookup ??TCP Connection ??TLS Handshake ??Server Processing ??Content Transfer
[ ????4ms ???| ?????30ms ?????| ????125ms ????| ??????36ms ???????| ???????0ms ??????]
????????????| ???????????????| ??????????????| ??????????????????| ?????????????????|
???namelookup:4ms ???????????| ??????????????| ??????????????????| ?????????????????|
???????????????????????connect:34ms ?????????| ??????????????????| ?????????????????|
???????????????????????????????????pretransfer:159ms ????????????| ?????????????????|
?????????????????????????????????????????????????????starttransfer:195ms ???????????|
????????????????????????????????????????????????????????????????????????????????total:195ms ?

[root@centos75master ~]# httpstat http://www.baidu.com
Connected to 115.239.211.112:80 from 10.24.101.161:44078

HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
Connection: Keep-Alive
Content-Length: 2381
Content-Type: text/html
Date: Fri, 21 Sep 2018 08:16:16 GMT
Etag: "588604fc-94d"
Last-Modified: Mon, 23 Jan 2017 13:28:28 GMT
Pragma: no-cache
Server: bfe/1.0.8.18
Set-Cookie: BDORZ=27315; max-age=86400; domain=.baidu.com; path=/

Body stored in: /tmp/tmpMV8IXt

?DNS Lookup ??TCP Connection ??Server Processing ??Content Transfer
[ ????4ms ???| ?????31ms ?????| ??????39ms ???????| ???????1ms ??????]
????????????| ???????????????| ??????????????????| ?????????????????|
???namelookup:4ms ???????????| ??????????????????| ?????????????????|
???????????????????????connect:35ms ?????????????| ?????????????????|
?????????????????????????????????????starttransfer:74ms ????????????|

 

httpstat的简单使用

原文地址:https://www.cnblogs.com/jinanxiaolaohu/p/9686561.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved