请求工具

HTTP Lint

HTTPolice 是一个简单的基于命令行的对于 HTTP 请求格式规范进行检测的工具,可以直接使用pip命令进行安装

pip install HTTPolice

当我们使用 Google Chrome、Firefox 或者 Microsoft Edge 进行网络访问时,可以使用开发者工具导出某个 HAR 文件,这也就是 HTTP Lint 工具可以用来解析的文件。使用如下命令进行分析

$ httpolice -i har /path/to/file.har
------------ request: GET /1441/25776044114_0e5b9879a0_z.jpg------------ response: 200 OKC 1277 Obsolete 'X-' prefix in X-Photo-FarmC 1277 Obsolete 'X-' prefix in X-Photo-OriginE 1000 Malformed Expires headerE 1241 Date + Age is in the future

默认的 HTTPolice 以文本形式输出报告文本,如下所示

------------ request: PUT /articles/109226/
E 1000 Malformed If-Match header
C 1093 User-Agent contains no actual product
------------ response: 204 No Content
C 1110 204 response with no Date header
E 1221 Strict-Transport-Security without TLS
------------ request: POST /articles/109226/comments/
...

纯文本的方式可能比较难以理解,我们可以使用-o html选项来设置更详细的基于 HTML 风格的输出,譬如

$ httpolice -i har -o html /path/to/file.har >report.html
上一页