dosse91 пре 9 година
родитељ
комит
ba58805e47
3 измењених фајлова са 10 додато и 7 уклоњено
  1. 3 3
      README.md
  2. 1 1
      garbage.php
  3. 6 3
      speedtest_worker.js

+ 3 - 3
README.md

@@ -5,14 +5,14 @@ No Flash, No Java, No Websocket, No Bullshit.
 This is a very lightweight Speedtest implemented in Javascript, using XMLHttpRequest and Web Workers.
 This is a very lightweight Speedtest implemented in Javascript, using XMLHttpRequest and Web Workers.
 
 
 ## Try it
 ## Try it
-[Take a Speedtest](http://speedtest.adolfintel.com)
+[Take a Speedtest](http://speedtest.fdossena.com)
 
 
 ## Compatibility
 ## Compatibility
 Only modern browsers are supported (Edge 12+)
 Only modern browsers are supported (Edge 12+)
 
 
 ## Requirements
 ## Requirements
  - A reasonably fast web server
  - A reasonably fast web server
- - Some way to generate garbage data using either the included PHP script, a [big file of random data](http://downloads.adolfintel.com/geth.php?r=speedtest-bigfile), or a symlink to /dev/urandom
+ - Some way to generate garbage data using either the included PHP script, a [big file of random data](http://downloads.fdossena.com/geth.php?r=speedtest-bigfile), or a symlink to /dev/urandom
  - Your server must accept large POST requests (up to 10 Megabytes), otherwise the upload test will fail
  - Your server must accept large POST requests (up to 10 Megabytes), otherwise the upload test will fail
  - Client side, there must not be any type of buffering (such as a proxy), or you may get incorrect results
  - Client side, there must not be any type of buffering (such as a proxy), or you may get incorrect results
  - It's also better if your server does not use compression, but it's not mandatory
  - It's also better if your server does not use compression, but it's not mandatory
@@ -21,7 +21,7 @@ Only modern browsers are supported (Edge 12+)
 See the examples, it's really simple.
 See the examples, it's really simple.
 
 
 ## License
 ## License
-Copyright (C) 2016 Federico Dossena
+Copyright (C) 2016-2017 Federico Dossena
 
 
 This program is free software: you can redistribute it and/or modify
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as published by
 it under the terms of the GNU Lesser General Public License as published by

+ 1 - 1
garbage.php

@@ -17,7 +17,7 @@ header("Pragma: no-cache");
 // Generate data
 // Generate data
 $data=openssl_random_pseudo_bytes(1048576);
 $data=openssl_random_pseudo_bytes(1048576);
 // Deliver chunks of 1048576 bytes
 // Deliver chunks of 1048576 bytes
-while(1){
+for($i=0;$i<100;$i++){
     echo $data;
     echo $data;
     flush();
     flush();
 }
 }

+ 6 - 3
speedtest_worker.js

@@ -82,9 +82,12 @@ function ulTest(done){
     }.bind(this);
     }.bind(this);
     xhr.open("POST",settings.url_ul+"?r="+Math.random(),true);
     xhr.open("POST",settings.url_ul+"?r="+Math.random(),true);
 	xhr.setRequestHeader('Content-Encoding','identity');
 	xhr.setRequestHeader('Content-Encoding','identity');
-	var r=new ArrayBuffer(10485760);
-	try{var w=new Float32Array(r);for(var i=0;i<w.length;i++)w[i]=Math.random();}catch(e){}
-    xhr.send(r);
+	var r=new ArrayBuffer(1048576);
+	try{r=new Float32Array(r);for(var i=0;i<r.length;i++)r[i]=Math.random();}catch(e){}
+	var req=[];
+	for(var i=0;i<20;i++) req.push(r);
+	req=new Blob(req);
+    xhr.send(req);
 }
 }
 function pingTest(done){
 function pingTest(done){
     var prevT=null,ping=0.0,i=0;
     var prevT=null,ping=0.0,i=0;