mirror of
https://github.com/ipxe/ipxe
synced 2025-12-25 09:01:24 +03:00
[uri] Decode/encode URIs when parsing/unparsing
Currently, handling of URI escapes is ad-hoc; escaped strings are stored as-is in the URI structure, and it is up to the individual protocol to unescape as necessary. This is error-prone and expensive in terms of code size. Modify this behavior by unescaping in parse_uri() and escaping in unparse_uri() those fields that typically handle URI escapes (hostname, user, password, path, query, fragment), and allowing unparse_uri() to accept a subset of fields to print so it can be easily used to generate e.g. the escaped HTTP path?query request. Signed-off-by: Joshua Oreman <oremanj@rwcr.net> Signed-off-by: Marty Connor <mdc@etherboot.org>
This commit is contained in:
committed by
Marty Connor
parent
ef9d1a32c6
commit
3d9dd93a14
@@ -1085,7 +1085,7 @@ static int fetchf_uristring ( struct settings *settings,
|
||||
|
||||
fetch_string_setting ( settings, setting, raw_buf,
|
||||
sizeof ( raw_buf ) );
|
||||
return uri_encode ( raw_buf, buf, len );
|
||||
return uri_encode ( raw_buf, buf, len, URI_FRAGMENT );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user