ddsol / speedtest.net

node.js SpeedTest.net client module
MIT License
607 stars 125 forks source link

Proxy Error: Unexpected close tag #52

Closed ghost closed 5 years ago

ghost commented 6 years ago

Hello,

I am trying to use the proxy feature, and I get an unexpected close tag anyway I run it.

I have tried speedtest-net --proxy "http://example.com:80"

I have also tried doing it directly in the code using

var test = speedTest({maxTime: 5000, proxy : "http://example.com:80"});

The error is as follows:

Error: Unexpected close tag
Line: 109
Column: 7
Char: >
    at error (/speedtest/node_modules/sax/lib/sax.js:651:10)
    at strictFail (/speedtest/node_modules/sax/lib/sax.js:677:7)
    at closeTag (/speedtest/node_modules/sax/lib/sax.js:871:9)
    at SAXParser.write (/speedtest/node_modules/sax/lib/sax.js:1436:13)
    at Parser.exports.Parser.Parser.parseString (/speedtest/node_modules/xml2js/lib/parser.js:322:31)
    at Parser.parseString (/speedtest/node_modules/xml2js/lib/parser.js:5:59)
    at exports.parseString (/speedtest/node_modules/xml2js/lib/parser.js:354:19)
    at /speedtest/node_modules/speedtest-net/index.js:299:5
    at /speedtest/node_modules/speedtest-net/index.js:107:16
    at IncomingMessage.<anonymous> (/speedtest/node_modules/speedtest-net/index.js:175:7)
ddsol commented 6 years ago

@devildant

devildant commented 6 years ago

Hello,

I use the speedtest with proxy every day and I have no problem, and, this is not an error because of the new proxy option. it's an xml parse error @ddsol @AdamSWheatley your proxy exist ? Is not this a proxy with authentication? if your proxy requires an auth it is possible that it redirects to a web page you can try to set the proxy with a login / password. for example : speedtest-net --proxy "http://**login:password@**example.com:80"

ghost commented 6 years ago

I use the proxy for other applications and definitely exists lol, It doesn't have any authentication. I assume it's a parse error with the proxy string, the only difference it has than the example provided is it has several dots, so http://test.one.uk.com:80 (not actually it)

devildant commented 6 years ago

i reproduce the problem with var test = speedTest({maxTime: 5000, proxy : "http://test.one.uk.com:80"}); but i don"t understand how work your proxy, you take the html content, that's why it does not work. this is not a problem with proxy management by the speedtest module. it may be a DNS problem, try to fill in the ip of your proxy in parameter to speed test module

ddsol commented 6 years ago

Better error added in #54

ddsol commented 5 years ago

Fixed in #82