|
@@ -927,35 +927,55 @@ var policies = {
|
|
|
return offenders;
|
|
|
}
|
|
|
},*/
|
|
|
- "http2": {
|
|
|
- "label": "HTTP/2 or SPDY",
|
|
|
- "message": "<p>HTTP/2 is the latest version of the HTTP protocol and is designed to optimize load speed. SPDY is deprecated but still very well supported.</p><p>The latest versions of all major browsers are now compatible. The difficulty is on the server side, where technologies are not quite ready yet.</p>",
|
|
|
+ "oldHttpProtocol": {
|
|
|
+ "label": "HTTP/1 requests",
|
|
|
+ "message": "<p>HTTP/2 is the latest version of the HTTP protocol. It is designed to optimize load speed. HTTP/3 will come soon and should be even faster!</p><p>When a domain sends more than 4 requests over HTTP/1, this metric counts one point for each new request. Below 5 requests, the benefits of HTTP/2 are generally less significant.</p>",
|
|
|
"hasOffenders": true,
|
|
|
"scoreFn": function(data) {
|
|
|
- if (!data.toolsResults.http2) {
|
|
|
- return null;
|
|
|
+ var count = 0;
|
|
|
+
|
|
|
+ var offenders = data.toolsResults.phantomas.offenders.oldHttpProtocol;
|
|
|
+
|
|
|
+ if (offenders) {
|
|
|
+ offenders.forEach(function(offender) {
|
|
|
+ if (offender.requests > 4) {
|
|
|
+ count += offender.requests - 4;
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- var isHttp2 = data.toolsResults.http2.metrics.http2;
|
|
|
+ var isOkThreshold = 0;
|
|
|
+ var isBadThreshold = 25;
|
|
|
+ var isAbnormalThreshold = 100;
|
|
|
|
|
|
+ var score = (isBadThreshold - count) * 100 / (isBadThreshold - isOkThreshold);
|
|
|
+ var abnormalityScore = (isAbnormalThreshold - count) * 100 / (isAbnormalThreshold - isOkThreshold);
|
|
|
+
|
|
|
+
|
|
|
var result = {
|
|
|
- value: isHttp2 ? 'Yes' : 'No',
|
|
|
- score: isHttp2 ? 100 : 0,
|
|
|
- bad: !isHttp2,
|
|
|
- abnormal: false,
|
|
|
- abnormalityScore: 0
|
|
|
+ value: count,
|
|
|
+ score: Math.min(Math.max(Math.round(score), 0), 100),
|
|
|
+ bad: count > isBadThreshold,
|
|
|
+ abnormal: count > isAbnormalThreshold,
|
|
|
+ abnormalityScore: Math.min(Math.round(abnormalityScore), 0),
|
|
|
+ offendersObj: {
|
|
|
+ count: data.toolsResults.phantomas.metrics.oldHttpProtocol,
|
|
|
+ list: data.toolsResults.phantomas.offenders.oldHttpProtocol || []
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
- if (data.toolsResults.http2.offenders) {
|
|
|
- result.offendersObj = {
|
|
|
- count: data.toolsResults.http2.offenders.http2.length,
|
|
|
- list: data.toolsResults.http2.offenders.http2
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
return result;
|
|
|
}
|
|
|
},
|
|
|
+ "oldTlsProtocol": {
|
|
|
+ "tool": "phantomas",
|
|
|
+ "label": "Old TLS protocols",
|
|
|
+ "message": "<p>Counts the number of domains that use TLS versions < 1.3. This is the latest version and it includes a faster \"handshake\" technology.</p><p>The 1.0 and 1.1 versions are deprecated because they are unsafe, switch to 1.2 or above as soon as possible.</p><p>The version 1.3 includes an even faster option called 0-RTT, check your server compatibility on <a href='https://www.ssllabs.com/ssltest/' target=\"_blank\">SSL Labs</a>.</p>",
|
|
|
+ "isOkThreshold": 0,
|
|
|
+ "isBadThreshold": 5,
|
|
|
+ "isAbnormalThreshold": 15,
|
|
|
+ "hasOffenders": true
|
|
|
+ },
|
|
|
"cachingDisabled": {
|
|
|
"tool": "phantomas",
|
|
|
"label": "Caching disabled",
|