Home / Docs / Specification / 31. HTTP servers

31.4 The target

Release v0.4.0
  1. Forms. The target MUST start with / (origin-form), or be in absolute-form, http:// or https:// in any letter case followed by an authority and an optional path and query. An absolute-form target is accepted only when its scheme is the grant's and its authority equals the Host value in ASCII letter case; it is then rewritten to the origin-form of its path and query, / for an empty path, which the program sees as target. Else it is 400. The asterisk-form and the authority-form are 400.
  2. Characters. The path holds only / and the characters of an RFC 3986 pchar; the query, after the first ?, holds those and ?. Each % MUST be followed by two hex digits. Anything else is 400: a #, a space, \, |, {, ", ^, a backquote, <, >, [, ], and any byte above 0x7E. RFC 3986 does not allow them unencoded.
  3. Segments. The path after its first / is split on /, and each segment is percent-decoded alone, so an encoded / never makes a new segment. A segment that decodes to . or .., or that holds /, \, NUL or another control character (below 0x20, or 0x7F), or that is not UTF-8 after decoding, is 400. / gives [""], and /a//b gives ["a", "", "b"]. Forms that other servers read as special, such as ..; and the double-encoded %252e%252e, are ordinary segments.
  4. Query. The query is split on &, and empty parts are skipped. Each part is name=value, split at its first =, or name with the value "". A + decodes to a space, then percent-decoding applies. A name or value that is not UTF-8 after decoding is 400.