[PATCH setup 2/3] Correctly make displayed_url for non-FQDNs
Jon TURNEY
jon.turney@dronecode.org.uk
Mon Apr 21 11:16:00 GMT 2014
Fix the logic for identifying protocol and site name part of the URL to find the
first '/' after a '//', rather than the first '/' after a '.', to handle
sitenames which aren't FQDNs correctly
This makes non-FQDNs added to the mirror list display correctly.
2010-11-26 Jon TURNEY <jon.turney@dronecode.org.uk>
* site.cc (init): Handle sitenames which aren't FQDNs correctly.
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
---
site.cc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/site.cc b/site.cc
index e7d4113..48ec0aa 100644
--- a/site.cc
+++ b/site.cc
@@ -150,8 +150,11 @@ site_list_type::init (const string &_url, const string &_servername,
url.append("/");
/* displayed_url is protocol and site name part of url */
- displayed_url = url.substr (0, url.find ("/", url.find (".")));
+ string::size_type path_offset = url.find ("/", url.find ("//") + 2);
+ displayed_url = url.substr(0, path_offset);
+ /* the sorting key is hostname components in reverse order (to sort by country code)
+ plus the url (to ensure uniqueness) */
key = string();
string::size_type last_idx = displayed_url.length () - 1;
string::size_type idx = url.find_last_of("./", last_idx);
--
1.8.5.5
More information about the Cygwin-apps
mailing list