HttpClient problem with URLs which include curly braces

后端 未结 2 1007
情书的邮戳
情书的邮戳 2020-12-19 10:36

I am using HttpClient for my android application. At some point, I have to fetch data from remote locations. Below is the snippet how I made use of HttpClient to get the res

2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-19 11:01

    Except RFC1738 has been obsolete for over a decade, has been superseded by rfc3986 and there is no indication in:

    https://tools.ietf.org/html/rfc3986

    That curly braces are unsafe (In fact, the RFC does not contain a single curly brace character anywhere). Furthermore, I've tried URI's in browsers that contain curly braces, and they work fine.

    Also note the OP is using a class called URI - which should definitely be following 3986, at the very least, if not 3987.

    However, oddly, IRIs defined in:

    https://tools.ietf.org/html/rfc3987

    Have the note that:

    Systems accepting IRIs MAY also deal with the printable characters in US-ASCII that are not allowed in URIs, namely "<", ">", '"', space, "{", "}", "|", "\", "^", and "`", in step 2 above. If these characters are found but are not converted, then the conversion
    SHOULD fail. Please note that the number sign ("#"), the percent
    sign ("%"), and the square bracket characters ("[", "]") are not part of the above list and MUST NOT be converted.

    In other words, it looks like the RFCs themselves have some issues.

提交回复
热议问题