1
0
Эх сурвалжийг харах

Fixed a problem with upload and ping test with nginx

dosse91 9 жил өмнө
parent
commit
ec61c14723
8 өөрчлөгдсөн 22 нэмэгдсэн , 15 устгасан
  1. 0 2
      .gitignore
  2. 11 8
      doc.md
  3. 0 0
      empty.dat
  4. 6 0
      empty.php
  5. 1 1
      example2.html
  6. 1 1
      example4.html
  7. 3 3
      speedtest_worker.js
  8. 0 0
      speedtest_worker.min.js

+ 0 - 2
.gitignore

@@ -1,2 +0,0 @@
-doc.odt
-cktest.html

+ 11 - 8
doc.md

@@ -1,7 +1,7 @@
 # HTML5 Speedtest
 
 > by Federico Dossena  
-> Version 4.2, April 26 2017  
+> Version 4.2.1, May 15 2017  
 > [https://github.com/adolfintel/speedtest/](https://github.com/adolfintel/speedtest/)
 
 
@@ -31,7 +31,7 @@ To install the test on your server, upload the following files:
 * `speedtest_worker.min.js`
 * `garbage.php`
 * `getIP.php`
-* `empty.dat`
+* `empty.php`
 
 You may also want to upload one of the examples to test it.  
 Later we'll see how to use the test without PHP.
@@ -139,11 +139,11 @@ w.postMessage('start {"param1": "value1", "param2": "value2", ...}')
 * __url_dl__: path to garbage.php or a large file to use for the download test
     * Default: `garbage.php`
     * __Important:__ path is relative to js file
-* __url_ul__: path to ab empty file or empty.dat to use for the upload test
-    * Default: `empty.dat`
+* __url_ul__: path to ab empty file or empty.php to use for the upload test
+    * Default: `empty.php`
     * __Important:__ path is relative to js file
-* __url_ping__: path to an empty file or empty.dat to use for the ping test
-    * Default: `empty.dat`
+* __url_ping__: path to an empty file or empty.php to use for the ping test
+    * Default: `empty.php`
     * __Important:__ path is relative to js file
 * __url_getIp__: path to getIP.php or replacement
     * Default: `getIP.php`
@@ -186,7 +186,7 @@ __Important:__ do not simply kill the worker while it's running, as it will leav
 
 
 ## Using the test without PHP
-If your server does not support PHP, or you're using something newer like Node.js, you can still use this test by replacing `garbage.php` and `getIP.php`.
+If your server does not support PHP, or you're using something newer like Node.js, you can still use this test by replacing `garbage.php`, `empty.php` and `getIP.php` with equivalents.
 
 ### Replacements
 
@@ -199,6 +199,9 @@ If you're using Node.js or some other server, your replacement should accept the
 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.
+
 #### Replacement for `getIP.php`
 Your replacement must simply respond with the client's IP as plaintext. Nothing fancy.
 
@@ -206,7 +209,7 @@ Your replacement must simply respond with the client's IP as plaintext. Nothing
 You need to start the test with your replacements like this:
 
 ```js
-w.postMessage('start {"url_dl": "newGarbageURL", "url_getIp": "newIpURL"}')
+w.postMessage('start {"url_dl": "newGarbageURL", "url_ul": "newEmptyURL", "url_ping": "newEmptyURL", "url_getIp": "newIpURL"}')
 ```
 
 

+ 0 - 0
empty.dat


+ 6 - 0
empty.php

@@ -0,0 +1,6 @@
+<?php
+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");
+?>

+ 1 - 1
example2.html

@@ -85,7 +85,7 @@
             jitter.textContent = data[5]
             ip.textContent = 'Your IP: ' + data[4]
         }
-        w.postMessage('start {"url_dl": "garbage.php", "url_ul": "empty.dat", "url_ping": "empty.dat", "time_dl": "10", "time_ul": "15", "count_ping": "30"}') // start with custom parameters. paths are relative to js file. you can omit parameters that you don't want to change
+        w.postMessage('start {"url_dl": "garbage.php", "url_ul": "empty.php", "url_ping": "empty.php", "time_dl": "10", "time_ul": "15", "count_ping": "30"}') // start with custom parameters. paths are relative to js file. you can omit parameters that you don't want to change
     </script>
 </body>
 </html>

+ 1 - 1
example4.html

@@ -85,7 +85,7 @@
                 document.getElementById('ip').textContent = 'Your IP: ' + data[4]
                 updateGauge(ggjitter, data[5])
             }
-            w.postMessage('start {"time_ul": "10", "time_dl": "10", "count_ping": "50", "url_dl": "garbage.php", "url_ul": "empty.dat", "url_ping": "empty.dat", "url_getIp": "getIP.php"}')
+            w.postMessage('start {"time_ul": "10", "time_dl": "10", "count_ping": "50", "url_dl": "garbage.php", "url_ul": "empty.php", "url_ping": "empty.php", "url_getIp": "getIP.php"}')
         }
         function abortTest() {
             if (w) w.postMessage('abort')

+ 3 - 3
speedtest_worker.js

@@ -1,5 +1,5 @@
 /*
-	HTML5 Speedtest v4.1
+	HTML5 Speedtest v4.2.1
 	by Federico Dossena
 	https://github.com/adolfintel/speedtest/
 	GNU LGPLv3 License
@@ -19,8 +19,8 @@ var settings = {
   time_dl: 15, // duration of download test in seconds
   count_ping: 35, // number of pings to perform in ping test
   url_dl: 'garbage.php', // path to a large file or garbage.php, used for download test. must be relative to this js file
-  url_ul: 'empty.dat', // path to an empty file, used for upload test. must be relative to this js file
-  url_ping: 'empty.dat', // path to an empty file, used for ping test. must be relative to this js file
+  url_ul: 'empty.php', // path to an empty file, used for upload test. must be relative to this js file
+  url_ping: 'empty.php', // path to an empty file, used for ping test. must be relative to this js file
   url_getIp: 'getIP.php', // path to getIP.php relative to this js file, or a similar thing that outputs the client's ip
   xhr_dlMultistream: 10, // number of download streams to use (can be different if enable_quirks is active)
   xhr_ulMultistream: 3, // number of upload streams to use (can be different if enable_quirks is active)

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
speedtest_worker.min.js


Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно