AnalysisArtifact

在事务内找到的文件,如图片、视频、文档、文本等。

本节包含以下内容:

GET

[基本地址]/shunra/api/analysis/artifact/{filehandle}

其中的项目句柄从分析报告获取 (请参阅“分析报告的结构”)。

例如: http://localhost:8182/shunra/api/analysis/artifact/620984c9a31b4ef694a1ac47d61b6a7e%2F-561678026%2Fccb8713e522241c9a691c4ed1ce72d27%2F94660f9c01724f63bedfefb370dc4575%2Fabf8bde63762421dbe29cab1cecae661

返回

  • 200“正常”
  • 404“找不到”
  • 500“内部服务器错误”

分析报告的结构

因针对特定事务执行步骤 (4) "Get Analysis Result",API 返回下列格式的 JSON 文档:

{
	"name":"Packet List 1",
	"successfullTransactionAnalysis":[{
		"status":"Finished",
		"result":{
			"type":"Best Practices Report",
			"subtype":"Web Applications Best Practices Report",
			"version":"0.5",
			-- Other, analysis engine dependent fields --
		},
		"name":"Undefined",
		"id":"fe15bdf3eafe4ec8bb1b055c49ca622b"
	}],
	"reportType":"best practices",
	"reportId":"129778102",
	"id":"1ae2d2ee02144e69801e0f3d1cb39d89",
	"failedTransactionAnalysis":[]
}
		

备注: 蓝色文本将列出实际报告。请注意,由于请求是针对具体事务的特定引擎,因此 "successfullTransactionAnalysis" 的结果只包含一个条目,其中列出了该事务的报告,包含事务的名称和 ID。所有报告都拥有共同的结构,具有 "type"、"subtype" 和 "version" 字段。

HTTP Waterfall 分析报告的结构

典型的 HTTP Waterfall 报告在 "subTransactions" 列表中包含很多条目,每个条目可能为下列两种类型之一:

  • HTTP request/response: 包含来自 HTTP 会话或已解密 HTTPS 会话的单个 HTTP 请求
  • HTTPS session: 包含有关未解密 HTTPS 会话 (用红色突出显示) 的详细信息

并非所有字段都为必填字段。在下文中,只有用红色标记的字段才需要在每个条目中都提供。例如,如果数据包列表中未捕获给定请求的响应,则与响应关联的所有字段都不会出现在该条目中。因此,只需要提供详细说明请求时间戳的组件。(目前,该报告只包含捕获了请求的 HTTP 请求/响应对。)

时间戳用蓝色标记,表示自 1970 年 1 月 1 日以来经过的秒数。响应数据的句柄用橙色标记。可使用 "Get Analysis Artifact" (5) API 调用检索响应数据本身。

{
	"type":"Waterfall report",
	"subtype":"Http Waterfall report",
	"version":"0.80",
	"subTransactions":[{
		"type":"HTTP request/response",
		"start":1333054863953,
		"end":1333054864640,
		"recomendations":"",
		"attributes":{
			"RequestContentSize":0,
			"ResponseContentType":"application/json; charset\u003dUTF-8",
			"StatusCode":401,
			"TcpReset": false,
			"Method":"POST",
			"Scheme":"https",
			"ResponseContentSize":104,
			"RequestHeaders":"POST /setup/ws/1/validate HTTP/1.1\r\nHost: 
			setup.example.com\r\ nAccept-Encoding: gzip, deflate\r\nConnection: keep-alive\r\nProxy-Connection: keep-alive\r\n",
			"TcpSession":4,
			"RequestData":"",
			"RequestContentType":"text/plain",
			"URI":"/setup/ws/1/validate",
			"ResponseData":
			"\\74b85bbff75340a9b744bf8b4d1f5f6b\\-1019702096\\5d35c39d1db84f3fa16786dc78eff622\\0703708ccbda491ba6d59944c1ef1114/78820e83d8634265900999172f134389",
			"ResponseHeaders":"HTTP/1.1 401 Unauthorized\r\nDate:
			Thu, 29 Mar 2012 21:01:04 GMT \r\nConnection:Keep-alive\r\n",
			"host":"setup.example.com",
			"Referer":"https://www.example.com/"
		},
		"components":[{
			"type":"DNSResolution",
			"start":1333054863853,
			"end":1333054863900
		},
		{
			"type":"TCPSetup",
			"start":1333054863900,
			"end":1333054863953
		},
		{
			"type":"ClientWaitAfterTCPSetup",
			"start":1333054863953,
			"end":1333054864418
		},
		{
			"type":"TLSHandshake",
			"start":1333054864418,
			"end":1333054864632
		},
		{
			"type":"request",
			"start":1333054864632,
			"end":1333054864632
		},
		{
			"type":"wait",
			"start":1333054864632,
			"end":1333054864640
		},
		{
			"type":"response",
			"start":1333054864640,
			"end":1333054864640
		}
	]},

	{
		"type":"HTTPS session",
		"start":1333054861902,
		"end":1333054863281,
		"recomendations":"",
		"attributes":{
			"SentBytes":384,
			"ReceivedBytes":5792,
			"host":"www.example.com",
			"TcpReset": false,
			"TcpSession":0
		},
		"components":[{
			"type":"TCPSetup",
			"start":1333054861902,
			"end":1333054861902
		},
		{
			"type":"ClientWaitAfterTCPSetup",
			"start":1333054861902,
			"end":1333054862731
		},
		{
			"type":"TLSHandshake",
			"start":1333054862731,
			"end":1333054863230
		},
		{
			"type":"EncryptedDataTransmission",
			"start":1333054863230,
			"end":1333054863281
		}
	]}
	--- OTHER HTTP and HTTPS ENTRIES --

]}
		

Best Practices 分析报告的结构

最佳实践报告相当简单。报告是条目的列表,每个条目代表一种最佳实践;在下列示例中,用蓝色突出显示了两种最佳实践。每种最佳实践包含以下字段:

  • Name
  • Description
  • 适用方案列表 (目前是 DesktopWeb 或 MobileSafari)
  • Score: 衡量事务对特定最佳实践的遵循程度 ([0,1] 范围内的数字)。
  • Weight: 衡量最佳实践对事务的影响 ([0,1] 范围内的数字)。
  • 违规字典: 该字典中的每个条目都说明了违反最佳实践的具体类型,同时列出了发生这种违规情况的资源 (或 TCP 会话)。请注意,如同下文中的 "Compress Components" 一样,事务可能没有任何违反特定最佳实践的情况。
{
	"type":"Best Practices Report",
	"subtype":"Web Applications Best Practices Report",
	"version":"0.5",
	"report":[{
		"violations":{},
		"name":"Compress Components",
		"scenarios":[
			"DesktopWeb",
			"MobileSafari"
		],
		"description":"Checks that textual elements are transferred in a compressed format.Compression usually reduces the response size by about 70%.Approximately 90% of current Internet traffic travels through browsers that claim to support gzip.",
		"score":100.0,
		"weight":1.0
	},
	{
		"violations":{
			"An expiration header was not found":[
				"http://platform.example.com/widgets.js"
			],
			"Expiration date is within the next two days":[
			"HTTP://media.example.com/media-proxy/picture1.jpg",
			"http://media.example.com/media-proxy/picture2.jpg",
			"http://media.example.com/media-proxy/picture3.jpg"
		]},
		"name":"Add long term headers expiration dates",
		"scenarios":[
			"DesktopWeb",
			"MobileSafari"
		],
		"description":"Near future headers expiration dates prevent effective caching.This results in a repeat visit to your site to be slower than necessary.",
		"score":65.0,
		"weight":0.8
	}]
}