Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no error validations #4

Open
mturnaviotov opened this issue May 10, 2016 · 4 comments
Open

no error validations #4

mturnaviotov opened this issue May 10, 2016 · 4 comments

Comments

@mturnaviotov
Copy link

os software:
-centos 7.2 (in openvz)
-nginx 1.6.3
-php 5.4.16 with php-fpm

no download result checking.

in chrome console:

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

500 xhr network.js:990

in nginx acces and ssl access logs
"GET /network.php?module=download&size=0&network-1462870505927 HTTP/1.1" 500 5
"POST /network.php?module=upload&size=2097152&network-1462871045121 HTTP/1.1" 413 600

--- nginx error.log:
"PHP Fatal error: Call to undefined function mb_strlen() in /var/www/speedtest/network.php"

client intended to send too large body: 2097152 bytes

in web browser:

It took less than 8 seconds to download 1342177280MB of data... Restarting with 2684354560MB!
It took less than 8 seconds to download 2684354560MB of data... Restarting with 5368709120MB!
It took less than 8 seconds to download 5368709120MB of data... Restarting with 10737418240MB!
It took less than 8 seconds to download 10737418240MB of data... Restarting with 21474836480MB!
It took less than 8 seconds to download 21474836480MB of data... Restarting with 42949672960MB!
It took less than 8 seconds to download 42949672960MB of data... Restarting with 85899345920MB!
It took less than 8 seconds to download 85899345920MB of data... Restarting with 171798691840MB!
It took less than 8 seconds to download 171798691840MB of data... Restarting with 343597383680MB!
It took less than 8 seconds to download 343597383680MB of data... Restarting with 687194767360MB!
It took less than 8 seconds to download 687194767360MB of data... Restarting with 1374389534720MB!
...
It took less than 8 seconds to download 7.555786372591432e+23MB of data... Restarting with 1.5111572745182865e+24MB!
It took less than 8 seconds to download 1.5111572745182865e+24MB of data... Restarting with 3.022314549036573e+24MB!

Finished download, average: NaNMbps

@enryIT
Copy link
Owner

enryIT commented May 10, 2016

It seems that you have gzip compression enabled under nginx settings and since the speedtest library does rely on a single big text string in order to mesure throughput, the compression makes it inoperative.

Please consider using this example in your nginx configuration file:

server {
    gzip off;
    ...
}

If you can confirm this as a possible solution you can make a pull request on this file.
https://github.com/enryIT/html5_speedtest/blob/master/network.php#l18

Here you can see I already disabled gzip by passing a new value for the apache environment variable "gzip", unfortunately I can't do the same with nginx as it doesn't support env variables.

@mturnaviotov
Copy link
Author

we fix it by php mbstring install, it can't install by default, so may be fix requirements list

@enryIT
Copy link
Owner

enryIT commented May 15, 2016

How can the multibyte extension solve the compression issue? Can you explain it or make a pull request on the README?

@thomasbergmann
Copy link

With enabled Firebug download test succeeded but was pretty slow. So, I guessed there is a connection between speed and correct measurement.

I changed content sizes in network.php and it fixes the issue:

// Define a content size for the response, defaults to 20MB.
$contentSize = 200 * 1024 * 1024;

if (!empty($_GET['size'])) {
    $contentSize = intval($_GET['size']);
    $contentSize = min($contentSize, 2000 * 1024 * 1024); // Maximum value: 200MB
}

I´m on nginx with following config:

location / {
gzip off;
client_max_body_size 1100M;
keepalive_timeout 0;
add_header Cache-Control 'no-cache, no-store, no-transform';
add_header Pragma 'no-cache';
add_header Access-Control-Allow-Origin '*';
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants