Home > Software design >  purpose of @ in urls without encoding
purpose of @ in urls without encoding

Time:01-19

As I heard

following symbols are reserved and can't be used without encoding in url.
* ' ( ) ; : @ & = $ , / ? % # [ ]

What's the real purpose of @without encoding in urls? how it can be used?

CodePudding user response:

According to RFC2396, it's a "reserved character":

[ ... ] their usage within the URI component is limited to their reserved purpose. If the data for a URI component would conflict with the reserved purpose, then the conflicting data must be escaped before forming the URI.

Though there is nothing preventing it from being used, so long as its use doesn't conflict with the intended purpose:

The "reserved" syntax class above refers to those characters that are allowed within a URI, but which may not be allowed within a particular component of the generic URI syntax; they are used as delimiters of the components described in Section 3.

And section 3 states:

The authority component is preceded by a double slash "//" and is terminated by the next slash "/", question-mark "?", or by the end of the URI. Within the authority component, the characters ";", ":", "@", "?", and "/" are reserved.

So an @ symbol is valid, so long as there are no query strings.

@ is also valid for the mailto protocol, and for connecting directly to specified servers via an IP-based protocol (<userinfo>@<host>:<port>), though it may be omitted if not making use of user information:

The parts "@" and ":" may be omitted.
server = [ [ userinfo "@" ] hostport ]

  •  Tags:  
  • Related