From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9841 invoked by alias); 21 Apr 2014 11:16:34 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 9800 invoked by uid 89); 21 Apr 2014 11:16:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: smtpout17.bt.lon5.cpcloud.co.uk Received: from smtpout17.bt.lon5.cpcloud.co.uk (HELO smtpout17.bt.lon5.cpcloud.co.uk) (65.20.0.137) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 21 Apr 2014 11:16:33 +0000 X-CTCH-RefID: str=0001.0A090206.5354FE11.0018,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 X-Junkmail-Premium-Raw: score=7/97,refid=2.7.2:2014.3.18.91815:17:7.944,ip=,rules=__HAS_FROM, __TO_MALFORMED_2, __TO_NO_NAME, __SUBJ_ALPHA_END, __HAS_MSGID, __SANE_MSGID, __HAS_X_MAILER, __IN_REP_TO, __ANY_URI, __URI_NO_WWW, __URI_NO_PATH, BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_1200_1299, __MIME_TEXT_ONLY, __URI_NS, HTML_00_01, HTML_00_10, BODY_SIZE_5000_LESS, BODY_SIZE_2000_LESS, BODY_SIZE_7000_LESS X-CTCH-Spam: Unknown Received: from localhost.localdomain (86.164.67.104) by smtpout17.bt.lon5.cpcloud.co.uk (8.6.100.99.10223) (authenticated as jonturney@btinternet.com) id 5318507B025AA838; Mon, 21 Apr 2014 12:16:34 +0100 From: Jon TURNEY To: cygwin-apps@cygwin.com Cc: Jon TURNEY Subject: [PATCH setup 2/3] Correctly make displayed_url for non-FQDNs Date: Mon, 21 Apr 2014 11:16:00 -0000 Message-Id: <1398078987-5116-3-git-send-email-jon.turney@dronecode.org.uk> In-Reply-To: <1398078987-5116-1-git-send-email-jon.turney@dronecode.org.uk> References: <1398078987-5116-1-git-send-email-jon.turney@dronecode.org.uk> X-SW-Source: 2014-04/txt/msg00054.txt.bz2 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 * site.cc (init): Handle sitenames which aren't FQDNs correctly. Signed-off-by: Jon TURNEY --- 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