Data URLs: parse the whole URL, not just the path.
The RFC for Data URLs specifies a nonstandard format, and because of this it doesn't support queries and fragments. This allows the use of the # and ? characters in the URL data. We didn't handle this properly, which would lead to truncated data.
This commit is contained in:
@@ -39,8 +39,16 @@ BDataRequest::_ProtocolLoop()
|
|||||||
ssize_t length;
|
ssize_t length;
|
||||||
bool isBase64 = false;
|
bool isBase64 = false;
|
||||||
|
|
||||||
|
// The RFC has examples where some characters are URL-Encoded.
|
||||||
fUrl.UrlDecode(true);
|
fUrl.UrlDecode(true);
|
||||||
BString data = fUrl.Path();
|
|
||||||
|
// The RFC says this uses a nonstandard scheme, so the path, query and
|
||||||
|
// fragment are a bit nonsensical. It would be nice to handle them, but
|
||||||
|
// some software (eg. WebKit) relies on data URIs with embedded "#" char
|
||||||
|
// in the data...
|
||||||
|
BString data = fUrl.UrlString();
|
||||||
|
data.Remove(0, 5); // remove "data:"
|
||||||
|
|
||||||
int separatorPosition = data.FindFirst(',');
|
int separatorPosition = data.FindFirst(',');
|
||||||
|
|
||||||
if (fListener != NULL)
|
if (fListener != NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user