[erlang-questions] http_uri:encode not quoting control characters

Mikl Kurkov mkurkov@REDACTED
Thu Jun 11 22:14:04 CEST 2015


Hi,

just figured out that http_uri:encode function doesn't percent-encode
control characters, like this:

```
http_uri:encode("new\nlines\nhere").
"new\nlines\nhere"
```

RFC3986 (https://www.ietf.org/rfc/rfc3986.txt) states that:

A percent-encoding mechanism is used to represent a data octet in a
   component when that octet's corresponding character is outside the
   allowed set or is being used as a delimiter of, or within, the
   component.

Characters that are allowed in a URI but do not have a reserved
   purpose are called unreserved.  These include uppercase and lowercase
   letters, decimal digits, hyphen, period, underscore, and tilde.

      unreserved  = ALPHA / DIGIT / "-" / "." / "_" / "~"

So it looks like control characters are not allowed in URI and should be
encoded.
I wonder why http_uri behaves like this, is it intentional?

Erlang 17.5.3
-- 
Mikl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150611/8d85eb70/attachment.htm>


More information about the erlang-questions mailing list