diff options
author | Michael Brown <mcb30@ipxe.org> | 2021-11-11 23:31:23 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2021-11-12 09:58:29 +0000 |
commit | 1844aacc837bf81cb1959fa65f2e52dcc70a0cae (patch) | |
tree | 8ad8156c38473e608269251518c125a8cb0bda5d /src/crypto | |
parent | 85eb961bf9afd61385430f8837485ba69cc0cc11 (diff) | |
download | ipxe-uri.zip ipxe-uri.tar.gz ipxe-uri.tar.bz2 |
[uri] Retain original encodings for path, query, and fragment fieldsuri
iPXE decodes any percent-encoded characters during the URI parsing
stage, thereby allowing protocol implementations to consume the raw
field values directly without further decoding.
When reconstructing a URI string for use in an HTTP request line, the
percent-encoding is currently reapplied in a reversible way: we
guarantee that our reconstructed URI string could be decoded to give
the same raw field values.
This technically violates RFC3986, which states that "URIs that differ
in the replacement of a reserved character with its corresponding
percent-encoded octet are not equivalent". Experiments show that
several HTTP server applications will attach meaning to the choice of
whether or not a particular character was percent-encoded, even when
the percent-encoding is unnecessary from the perspective of parsing
the URI into its component fields.
Fix by storing the originally encoded substrings for the path, query,
and fragment fields and using these original encoded versions when
reconstructing a URI string. The path field is also stored as a
decoded string, for use by protocols such as TFTP that communicate
using raw strings rather than URI-encoded strings. All other fields
(such as the username and password) continue to be stored only in
their decoded versions since nothing ever needs to know the originally
encoded versions of these fields.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/crypto')
0 files changed, 0 insertions, 0 deletions