Open StanleyWCTan opened 2 years ago
Came here to report the same. It looks like https://github.com/visionmedia/superagent/blob/master/src/node/index.js#L850 throws an exception when non ascii characters are tried to be used as header values. According to https://nodejs.org/dist/latest-v16.x/docs/api/http.html#requestsetheadername-value it seems such values should be URIEncoded first?
I'm using superagent as a rookie programer, but get stuck on below issue, please shed some light on it, many thanks! Due to some reasons, we still using old version of Election, maybe this is not the root cause.
Electon: v4.x, Node.js: v8.x Superagent: v6.1.0
Site:
https://www.a1distribution.ca/fr Links: ( links is from home page ) http://www.a1imports.ca/fr/Page/Contact http://www.a1imports.ca/fr/Base/ChangeLanguage http://www.a1imports.ca/fr/Catalog?attid=U%E2%80%A0h%C2%A4%24%7D%21c%E2%82%AC%E2%80%A2 http://www.a1imports.ca/fr/Catalog?attid=U%E2%80%A0h%C2%A4%24%7D%40%7D%E2%80%A0o
Code snipet: // ----------------------------------------------- let errorCount = 0; for (let i=0; i<links.length; i++) { let link = links[i]; try { /**
// -----------------------------------------------
process.on('uncaughtException', function(err) { loggerSys.error(err); app.exit(900); });
//--------------------- log ------------------- [2021-09-07 15:50:25.209] [ERROR] sys - TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["Host"] at ClientRequest.setHeader (_http_outgoing.js:473:3) at new ClientRequest (_http_client.js:213:12) at Object.request (https.js:280:10) at Request.request (C:\Workspace\Electron\cusdig\node_modules\superagent\lib\node\index.js:795:18) at Request.end (C:\Workspace\Electron\cusdig\node_modules\superagent\lib\node\index.js:951:8) at Request._redirect (C:\Workspace\Electron\cusdig\node_modules\superagent\lib\node\index.js:552:8) at ClientRequest. (C:\Workspace\Electron\cusdig\node_modules\superagent\lib\node\index.js:1020:21)
at Object.onceWrapper (events.js:273:13)
at ClientRequest.emit (events.js:182:13)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:555:21)