|
@@ -1,6 +1,6 @@
|
|
|
# LibreSpeed
|
|
|
|
|
|
-> by Federico Dossena
|
|
|
+> by Federico Dossena
|
|
|
> Version 5.2.4
|
|
|
> [https://github.com/librespeed/speedtest/](https://github.com/librespeed/speedtest/)
|
|
|
|
|
@@ -109,7 +109,7 @@ A basic front-end for visualizing and searching tests by ID is available in `res
|
|
|
A login is required to access the interface. __Important__: change the default password in `results/telemetry_settings.php`.
|
|
|
|
|
|
#### The end
|
|
|
-Now that the test is installed, rename one of the examples to `index.html` and delete the other examples.
|
|
|
+Now that the test is installed, rename one of the examples to `index.html` and delete the other examples.
|
|
|
The best starting point for most people is `example-singleServer-gauges.html`. If you want to use telemetry and results sharing, use `example-singleServer-full.html` instead.
|
|
|
|
|
|
If you're not using telemetry and results sharing, you can delete the `results` folder too.
|
|
@@ -117,7 +117,7 @@ If you're not using telemetry and results sharing, you can delete the `results`
|
|
|
Details about the examples and how to make custom UIs will be discussed later. If you don't want to make a custom UI, feel free to modify the example and replace "LibreSpeed Example" with the name of your test.
|
|
|
|
|
|
#### Privacy
|
|
|
-Telemetry contains personal information (according to GDPR defintion), therefore it is important to treat this data respectfully of national and international laws, especially if you plan to offer the service in the European Union.
|
|
|
+Telemetry contains personal information (according to GDPR definition), therefore it is important to treat this data respectfully of national and international laws, especially if you plan to offer the service in the European Union.
|
|
|
|
|
|
`example-singleServer-full.html` and `example-multipleServers-full.html` both contain a privacy policy for the service: you MUST read it, change it if necessary, and add your email address for data deletion requests. __Failure to comply with GDPR regulations can get you in serious trouble.__
|
|
|
|
|
@@ -459,7 +459,7 @@ s.selectServer(function(server){
|
|
|
//do something
|
|
|
})
|
|
|
```
|
|
|
-The `selectServer` function is asynchronous in order to avoid freeing the UI, and it will run a callback function when it is done choosing the server with the lowest ping.
|
|
|
+The `selectServer` function is asynchronous in order to avoid freeing the UI, and it will run a callback function when it is done choosing the server with the lowest ping.
|
|
|
The `server` argument is the selected server, and you can display it in the UI if you want. __You cannot start the test until the selection is done!__
|
|
|
|
|
|
You can also set the test point manually (for instance, from a combobox in the UI):
|
|
@@ -483,7 +483,7 @@ s.abort();
|
|
|
When the test is finished, you can run it again if you want, or you can just destroy `s`.
|
|
|
|
|
|
## Implementation details
|
|
|
-The purpose of this section is to help developers who want to make changes to the inner workings of the speed test.
|
|
|
+The purpose of this section is to help developers who want to make changes to the inner workings of the speed test.
|
|
|
It will be divided into 4 sections: `speedtest.js`, `speedtest_worker.js`, the `backend` files and the `results` files.
|
|
|
|
|
|
### `speedtest.js`
|
|
@@ -506,16 +506,16 @@ You can think of this as a finite state machine. These are the states (use getSt
|
|
|
```
|
|
|
While in state 1, you can only add test points, you cannot change the test settings. When you're done, use selectServer(callback) to select the test point with the lowest ping. This is asynchronous, when it's done, it will call your callback function and move to state 2. Calling setSelectedServer(server) will manually select a server and move to state 2.
|
|
|
* __2__: test point selected, ready to start the test. Use `start()` to begin, this will move to state 3
|
|
|
-* __3__: test running. Here, your `onupdate` event calback will be called periodically, with data coming from the worker about speed and progress. A data object will be passed to your `onupdate` function, with the following items:
|
|
|
- - `dlStatus`: download speed in mbps
|
|
|
- - `ulStatus`: upload speed in mbps
|
|
|
+* __3__: test running. Here, your `onupdate` event callback will be called periodically, with data coming from the worker about speed and progress. A data object will be passed to your `onupdate` function, with the following items:
|
|
|
+ - `dlStatus`: download speed in Mbit/s
|
|
|
+ - `ulStatus`: upload speed in Mbit/s
|
|
|
- `pingStatus`: ping in ms
|
|
|
- `jitterStatus`: jitter in ms
|
|
|
- `dlProgress`: progress of the download test as a float 0-1
|
|
|
- `ulProgress`: progress of the upload test as a float 0-1
|
|
|
- `pingProgress`: progress of the ping/jitter test as a float 0-1
|
|
|
- `testState`: state of the test (-1=not started, 0=starting, 1=download test, 2=ping+jitter test, 3=upload test, 4=finished, 5=aborted)
|
|
|
- - `clientIp`: IP address of the client performing the test (and optionally ISP and distance)
|
|
|
+ - `clientIp`: IP address of the client performing the test (and optionally ISP and distance)
|
|
|
At the end of the test, the `onend` function will be called, with a boolean specifying whether the test was aborted or if it ended normally.
|
|
|
The test can be aborted at any time with `abort()`.
|
|
|
At the end of the test, it will move to state 4
|
|
@@ -575,7 +575,7 @@ Starts the test.
|
|
|
|
|
|
Note (multiple points of test): the selected server will be added to the `telemetry_extra` string. If this string was already set, then `telemetry_extra` will be a JSON string containing both the server and the original string
|
|
|
|
|
|
-During the test, the `onupdate(data)` callback function will be called periodically with data from the worker.
|
|
|
+During the test, the `onupdate(data)` callback function will be called periodically with data from the worker.
|
|
|
At the end of the test, the `onend(aborted)` function will be called with a boolean telling you if the test was aborted or if it ended normally.
|
|
|
|
|
|
##### abort()
|
|
@@ -664,7 +664,7 @@ Access-Control-Allow-Headers: Content-Encoding, Content-Type
|
|
|
This file stores telemetry information into the database.
|
|
|
|
|
|
Data is passed as POST parameters:
|
|
|
-* `ispinfo`: ISP info (if enabled, empty strng otherwise)
|
|
|
+* `ispinfo`: ISP info (if enabled, empty string otherwise)
|
|
|
* `extra`: the `telemetry_extra` string passed to the worker (if set, empty string otherwise)
|
|
|
* `dl`: download speed
|
|
|
* `ul`: upload speed
|
|
@@ -741,14 +741,14 @@ s.setParameter("url_ping","backend/empty.dat");
|
|
|
s.setParameter("test_order","P_D_U");
|
|
|
```
|
|
|
|
|
|
-This will point to our static files and set the test to only do ping/jitter, download and uplod tests.
|
|
|
+This will point to our static files and set the test to only do ping/jitter, download and upload tests.
|
|
|
|
|
|
## Troubleshooting
|
|
|
These are the most common issues reported by users, and how to fix them. If you still need help, contact me at [[email protected]](mailto:[email protected]).
|
|
|
|
|
|
#### Download test gives very low result
|
|
|
-Are garbage.php and empty.php (or your replacements) reachable?
|
|
|
-Press F12, select network and start the test. Do you see errors? (cancelled requests are not errors)
|
|
|
+Are garbage.php and empty.php (or your replacements) reachable?
|
|
|
+Press F12, select network and start the test. Do you see errors? (cancelled requests are not errors)
|
|
|
If a small download starts, open it in a text editor. Does it say it's missing openssl_random_pseudo_bytes()? In this case, install OpenSSL (this is usually included when you install Apache and PHP on most distros).
|
|
|
|
|
|
#### Upload test is inaccurate, and/or I see lag spikes
|
|
@@ -764,15 +764,15 @@ You're running the test on localhost, therefore it is trying to measure the spee
|
|
|
Make sure your server is sending the `Connection:keep-alive` header
|
|
|
|
|
|
#### The server is behind a load balancer, proxy, etc. and I get the wrong IP address
|
|
|
-Edit getIP.php and replace lines 14-23 with what is more appropriate in your scenario.
|
|
|
+Edit getIP.php and replace lines 14-23 with what is more appropriate in your scenario.
|
|
|
Example: `$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];`
|
|
|
|
|
|
#### The results sharing just generates a blank image
|
|
|
-If the image doesn't display and the browser displays a broken image icon, FreeType2 is not installed or configured properly.
|
|
|
+If the image doesn't display and the browser displays a broken image icon, FreeType2 is not installed or configured properly.
|
|
|
If the image is blank, this usually happens because PHP can't find the font files inside the `results` folder. You can fix your PHP config or edit `results/index.php` and use absolute paths for the fonts. This is a [known issue with PHP](http://php.net/manual/en/function.imagefttext.php) and no real solution is known.
|
|
|
|
|
|
#### My server is behind Cloudflare and I can't reach full speed on some of the tests
|
|
|
-This is not a speed test related issue, as it can be replicated in virtually any HTTP file upload/download.
|
|
|
+This is not a speed test related issue, as it can be replicated in virtually any HTTP file upload/download.
|
|
|
Go to your domain's DNS settings and change "DNS and HTTP proxy (CDN)" to "DNS only", and wait for the settings to be applied (can take a few minutes).
|
|
|
|
|
|
#### On Windows Server, using IIS, the upload test doesn't work, CORS errors are visible in the console
|
|
@@ -781,33 +781,33 @@ This is a configuration issue. Make a file called web.config in wwwroot and adap
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
<configuration>
|
|
|
<system.webServer>
|
|
|
- <cors enabled="true" failUnlistedOrigins="false">
|
|
|
- <add origin="*">
|
|
|
+ <cors enabled="true" failUnlistedOrigins="false">
|
|
|
+ <add origin="*">
|
|
|
<allowHeaders allowAllRequestedHeaders="true" />
|
|
|
- <allowMethods>
|
|
|
- <add method="GET" />
|
|
|
- <add method="POST" />
|
|
|
- <add method="PUT" />
|
|
|
- <add method="DELETE" />
|
|
|
- <add method="OPTIONS" />
|
|
|
- </allowMethods>
|
|
|
+ <allowMethods>
|
|
|
+ <add method="GET" />
|
|
|
+ <add method="POST" />
|
|
|
+ <add method="PUT" />
|
|
|
+ <add method="DELETE" />
|
|
|
+ <add method="OPTIONS" />
|
|
|
+ </allowMethods>
|
|
|
<exposeHeaders>
|
|
|
- </exposeHeaders>
|
|
|
+ </exposeHeaders>
|
|
|
</add>
|
|
|
- </cors>
|
|
|
- </system.webServer>
|
|
|
+ </cors>
|
|
|
+ </system.webServer>
|
|
|
</configuration>
|
|
|
```
|
|
|
|
|
|
#### ID obfuscation doesn't work (incorrect output, blank results image)
|
|
|
-ID obfuscation only works on 64-bit PHP (requires PHP_INT_SIZE to be 8).
|
|
|
+ID obfuscation only works on 64-bit PHP (requires PHP_INT_SIZE to be 8).
|
|
|
Note that older versions of PHP 5 on Windows use PHP_INT_SIZE of 4, even if they're 64 bit. If you're in this situation, update your PHP install.
|
|
|
|
|
|
Also, make sure that the web server has write permission on the `results` folder.
|
|
|
|
|
|
## Known bugs and limitations
|
|
|
### General
|
|
|
-* 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. Different browsers may also show different results, especially on very fast connections on slow devices.
|
|
|
+* The ping/jitter test is measured by seeing how long it takes for an empty XHR to complete. It is not an actual ICMP ping. Different browsers may also show different results, especially on very fast connections on slow devices.
|
|
|
### IE specific
|
|
|
* The upload test is not precise on very fast connections with high latency (will probably be fixed by Edge 17)
|
|
|
* On IE11, a same origin policy error is erroneously triggered under unknown conditions. Seems to be related to running the test from unusual URLs like a top level domain (for instance http://abc/speedtest). These are bugs in IE11's implementation of the same origin policy, not in the speed test itself.
|
|
@@ -818,7 +818,7 @@ Also, make sure that the web server has write permission on the `results` folder
|
|
|
## Contributing
|
|
|
Since this is an open source project, you can modify it.
|
|
|
|
|
|
-If you made some changes that you think should make it into the main project, send a Pull Request on GitHub, or contact me at [[email protected]](mailto:[email protected]).
|
|
|
+If you made some changes that you think should make it into the main project, send a Pull Request on GitHub, or contact me at [[email protected]](mailto:[email protected]).
|
|
|
We don't require you to use a specific coding convention, write the code however you want and we'll change the formatting if necessary.
|
|
|
|
|
|
Donations are also appreciated: you can donate with [PayPal](https://www.paypal.me/sineisochronic) or [Liberapay](https://liberapay.com/fdossena/donate).
|