浏览代码

Improved ping/jitter test

dosse91 9 年之前
父节点
当前提交
23b188b3ce
共有 4 个文件被更改,包括 6 次插入4 次删除
  1. 3 2
      doc.md
  2. 1 0
      empty.php
  3. 2 2
      speedtest_worker.js
  4. 0 0
      speedtest_worker.min.js

+ 3 - 2
doc.md

@@ -1,7 +1,7 @@
 # HTML5 Speedtest
 
 > by Federico Dossena  
-> Version 4.2.2, June 13 2017  
+> Version 4.2.3, June 14 2017  
 > [https://github.com/adolfintel/speedtest/](https://github.com/adolfintel/speedtest/)
 
 
@@ -206,7 +206,7 @@ It is important here to turn off compression, and generate incompressible data.
 A symlink to `/dev/urandom` is also ok.
 
 #### Replacement for `empty.php`
-Your replacement must simply respond with a HTTP code 200 and send nothing else. You may want to send additional headers to disable caching.
+Your replacement must simply respond with a HTTP code 200 and send nothing else. You may want to send additional headers to disable caching. The test assumes that Connection:keep-alive is sent by the server.
 
 #### Replacement for `getIP.php`
 Your replacement must simply respond with the client's IP as plaintext. Nothing fancy.
@@ -220,6 +220,7 @@ w.postMessage('start {"url_dl": "newGarbageURL", "url_ul": "newEmptyURL", "url_p
 
 
 ## Known bugs and limitations
+* The ping/jitter test is measured by seeing how long it takes for an empty XHR to complete. It is not an acutal ICMP ping
 * __Chrome:__ high CPU usage from XHR requests with very fast connections (like gigabit).
   For this reason, the test may report inaccurate results if your CPU is too slow. (Does not affect most computers)
 * __IE11:__ the upload test is not precise on very fast connections

+ 1 - 0
empty.php

@@ -3,4 +3,5 @@ header( "HTTP/1.1 200 OK" );
 header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
 header("Cache-Control: post-check=0, pre-check=0", false);
 header("Pragma: no-cache");
+header("Connection: keep-alive");
 ?>

+ 2 - 2
speedtest_worker.js

@@ -1,5 +1,5 @@
 /*
-	HTML5 Speedtest v4.2.2
+	HTML5 Speedtest v4.2.3
 	by Federico Dossena
 	https://github.com/adolfintel/speedtest/
 	GNU LGPLv3 License
@@ -325,7 +325,7 @@ function pingTest (done) {
       if (i === 0) {
         prevT = new Date().getTime() // first pong
       } else {
-        var instspd = (new Date().getTime() - prevT) / 2
+        var instspd = (new Date().getTime() - prevT)
         var instjitter = Math.abs(instspd - prevInstspd)
         if (i === 1) ping = instspd; /* first ping, can't tell jiutter yet*/ else {
           ping = ping * 0.9 + instspd * 0.1 // ping, weighted average

文件差异内容过多而无法显示
+ 0 - 0
speedtest_worker.min.js


部分文件因为文件数量过多而无法显示