hrev52311 adds 1 changeset to branch 'master'
old head: 44c4473bf03a3cedebc3c08e0b4c4701e879fb9c
new head: 3cc5e76f2d754d213cb896d1cc0dea5d43854b13
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=3cc5e76f2d75+%5E44c4473bf03a
----------------------------------------------------------------------------
3cc5e76f2d75: Support : Fixes for Verbatim Regeneration of URL String Form
A URL in string form should be able to be parsed and then verbatim
regenerated according to 'UrlTest'. This change fixes this ability
for the case where there is a '?' initiating a query or a '//'
initiating a host/authority section.
Partly Fixes #14377
Change-Id: I6547253c3cdc22d79514edf75284e9725d1a2d17
Reviewed-on: https://review.haiku-os.org/512
Reviewed-by: Jérôme Duval <jerome.duval@xxxxxxxxx>
[ Andrew Lindesay <apl@xxxxxxxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev52311
Commit: 3cc5e76f2d754d213cb896d1cc0dea5d43854b13
URL: https://git.haiku-os.org/haiku/commit/?id=3cc5e76f2d75
Author: Andrew Lindesay <apl@xxxxxxxxxxxxxx>
Date: Tue Sep 4 21:31:12 2018 UTC
Committer: Jérôme Duval <jerome.duval@xxxxxxxxx>
Commit-Date: Wed Sep 5 09:05:10 2018 UTC
Ticket: https://dev.haiku-os.org/ticket/14377
----------------------------------------------------------------------------
1 file changed, 11 insertions(+)
src/kits/support/Url.cpp | 11 +++++++++++
----------------------------------------------------------------------------
diff --git a/src/kits/support/Url.cpp b/src/kits/support/Url.cpp
index 5ce7a457a4..d625d4f0ec 100644
--- a/src/kits/support/Url.cpp
+++ b/src/kits/support/Url.cpp
@@ -984,6 +984,7 @@ BUrl::_ExplodeUrlString(const BString& url)
explode_url_parse_state state = EXPLODE_PROTOCOL;
int32 offset = 0;
int32 length = url.Length();
+ bool forceHasHost = false;
const char *url_c = url.String();
// The regexp is provided in RFC3986 (URI generic syntax), Appendix B
@@ -1033,6 +1034,9 @@ BUrl::_ExplodeUrlString(const BString& url)
// to parsing the path.
if (strncmp(&url_c[offset], "//", 2) == 0) {
state = EXPLODE_AUTHORITY;
+ // if we see the // then this would
imply that a host is
+ // to be rendered even if no host has
been parsed.
+ forceHasHost = true;
offset += 2;
} else {
state = EXPLODE_PATH;
@@ -1068,6 +1072,10 @@ BUrl::_ExplodeUrlString(const BString& url)
offset,
explode_is_request_char);
SetRequest(BString(&url_c[offset],
end_request - offset));
offset = end_request;
+ // if there is a "?" in the parse then
it is clear that
+ // there is a 'request' / query present
regardless if there
+ // are any valid key-value pairs.
+ fHasRequest = true;
}
state = EXPLODE_FRAGMENT;
break;
@@ -1091,6 +1099,9 @@ BUrl::_ExplodeUrlString(const BString& url)
}
}
+ if (forceHasHost)
+ fHasHost = true;
+
return B_OK;
}