Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

URI malformed problem in decodeURIComponent #67

Closed
psvensson opened this issue Feb 14, 2010 · 5 comments
Closed

URI malformed problem in decodeURIComponent #67

psvensson opened this issue Feb 14, 2010 · 5 comments

Comments

@psvensson
Copy link

Hi, I've opened up a node app which uses fab on port 8080. This means I get a lot of happy junk thrown my way, bots trolling for proxies, basically. That's not an issue until the urls contain multiple encoded characters, like %20 et.c.

I then get the following:

URIError: URI malformed
at decodeURIComponent (native)
at Object.unescape (/usr/local/lib/node/libraries/querystring.js:6:10)
at parsePiece (/usr/local/lib/node/libraries/querystring.js:94:21)
at Array.map (native)
at Object.<anonymous> (/usr/local/lib/node/libraries/querystring.js:73:6)
at Object.url_parse [as parse] (/usr/local/lib/node/libraries/url.js:77:31)
at [object Object].init (/root/node/fab/lib/node.js:78:28)
at new <anonymous> (/root/node/fab/lib/core.js:315:41)
at Server.<anonymous> (/root/node/fab/lib/node.js:29:14)
at EventEmitter.<anonymous> (/usr/local/lib/node/libraries/http.js:411:23)

It seems to work fine with just one char, like a single %20 somewhere, but breaks on long lines of encoded garbage.

@WizKid
Copy link

WizKid commented Feb 14, 2010

May I guess that you have the same problem as I had in http://github.com/ry/node/issues#issue/60

@psvensson
Copy link
Author

OK, This does indeed seem to be a dulicate of http://github.com/ry/node/issues#issue/60
But shouldn't that be fixed to not break on strangeness?

@ncb000gt
Copy link

It looks like this issue can probably be closed per: http://github.com/ry/node/issues/issue/60#issue/60/comment/175870

@sleepycat
Copy link

I just ran into this error when a client encoded 'ê' as '%EA' and an 'é' as "%E9" and then sent them to my node server. Attempting to decode either of them result in the uri malformed error:

decodeURIComponent("%EA");
URIError: URI malformed
at decodeURIComponent (native)
at repl:1:1
at REPLServer.self.eval (repl.js:110:21)
at repl.js:249:20
at REPLServer.self.eval (repl.js:122:7)
at Interface. (repl.js:239:12)
at Interface.EventEmitter.emit (events.js:95:17)
at Interface._onLine (readline.js:202:10)
at Interface._line (readline.js:531:8)
at Interface._ttyWrite (readline.js:760:14)

I thought I would post this to put it back on the radar since it seems the working assumption is that it is fixed.

@rlidwka
Copy link

rlidwka commented Dec 8, 2013

I thought I would post this to put it back on the radar since it seems the working assumption is that it is fixed.

I believe it's a bug in your client. It should send utf8-encoded characters, but it uses some weird one-byte encoding instead.

> encodeURIComponent('ê')
'%C3%AA'
> decodeURIComponent('%c3%aa')
'ê'

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants