summaryrefslogtreecommitdiffstats
path: root/src/core/uri.c
diff options
context:
space:
mode:
authorMichael Brown2016-01-26 17:16:13 +0100
committerMichael Brown2016-01-26 17:16:13 +0100
commite55ec845e6ed889a43c14c72ddb9183e0b87c60b (patch)
treea86a7705f40d57105e2e6bfdc2643b20b7364b8f /src/core/uri.c
parent[tftp] Mangle initial slash on TFTP URIs (diff)
downloadipxe-e55ec845e6ed889a43c14c72ddb9183e0b87c60b.tar.gz
ipxe-e55ec845e6ed889a43c14c72ddb9183e0b87c60b.tar.xz
ipxe-e55ec845e6ed889a43c14c72ddb9183e0b87c60b.zip
[uri] Apply URI decoding for all parsed URIs
The various early-exit paths in parse_uri() accidentally bypass the URI field decoding. The result is that opaque or relative URIs do not undergo URI field decoding, resulting in double-encoding when the URIs are subsequently used. For example: #!ipxe set mac ${macstring} imgfetch /boot/by-mac/${mac:uristring} would result in an HTTP GET such as GET /boot/by-mac/00%253A0c%253A29%253Ac5%253A39%253Aa1 HTTP/1.1 rather than the expected GET /boot/by-mac/00%3A0c%3A29%3Ac5%3A39%3Aa1 HTTP/1.1 Fix by ensuring that URI decoding is always applied regardless of the URI format. Reported-by: Andrew Widdersheim <awiddersheim@inetu.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/uri.c')
-rw-r--r--src/core/uri.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/uri.c b/src/core/uri.c
index a8fdb70a..aa6eedb9 100644
--- a/src/core/uri.c
+++ b/src/core/uri.c
@@ -419,11 +419,11 @@ struct uri * parse_uri ( const char *uri_string ) {
uri->port = tmp;
}
+ done:
/* Decode fields in-place */
for ( field = 0 ; field < URI_FIELDS ; field++ )
uri_decode_inplace ( uri, field );
- done:
DBGC ( uri, "URI parsed \"%s\" to", uri_string );
uri_dump ( uri );
DBGC ( uri, "\n" );