taganaka / SpeedTest

Yet another unofficial speedtest.net client cli interface
331 stars 83 forks source link

Fix uncaught exception of stof #61

Closed gglluukk closed 7 months ago

gglluukk commented 8 months ago

Fixes https://github.com/taganaka/SpeedTest/issues/60

tcooper-xx commented 8 months ago

Can confirm fix works on Ubuntu 22.04

bmxkris commented 8 months ago

Works for me on Debian GNU/Linux 12 (bookworm)

OboTheHobo commented 8 months ago

Works for me as well on Fedora 39

aidan-gibson commented 8 months ago

Can confirm on arch

FaazHafid commented 8 months ago

Hi,

New here, how do I fix this with the code? Is there instructions to do that, apologies not too much familiar with GitHub or linux.

OboTheHobo commented 8 months ago

Hi,

New here, how do I fix this with the code? Is there instructions to do that, apologies not too much familiar with GitHub or linux.

inside the directory for SpeedTest, run git pull https://github.com/gglluukk/SpeedTest and then recompile as shown in the readme (the cmake and make command)

Stew-McD commented 7 months ago

Hi,

New here, how do I fix this with the code? Is there instructions to do that, apologies not too much familiar with GitHub or linux.

gh pr checkout 61

then the same install again

ansemjo commented 7 months ago

There's some extraneous quotes around the IP and ISP when printing the values. I'm not sure if that's due to the explicit casting to strings or if the JSON library you used does something weird?

It's not a problem for textual outputs obviously but completely breaks JSON output because that is a simple string concatenation in main.cpp (actual values replaced, obviously):

{"client":{"ip":""x.x.x.x"","lat":"00.0000","lon":"00.0000","isp":""Deutsche Telekom AG""},"servers_online":"10","server":{"name":"Strasbourg","sponsor":"bvpn.eu","distance":"222.986","latency":"23","host":"ookla.de.eu.waselpro.com:8080"},"ping":"23","jitter":"0","_":"only latency requested"}

Can be fixed with:

    try {
        map["ip_address"] = obj["ip"].ToString();
        map["isp"] = obj["company"]["name"].ToString();
        map["lat"] = obj["location"]["latitude"].dump();
        map["lon"] = obj["location"]["longitude"].dump();
    } catch(...) {}
taganaka commented 7 months ago

Thanks for helping on this!