public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Jon TURNEY <jon.turney@dronecode.org.uk>
To: cygwin-apps@cygwin.com
Cc: Jon TURNEY <jon.turney@dronecode.org.uk>
Subject: [PATCH setup 2/3] Correctly make displayed_url for non-FQDNs
Date: Mon, 21 Apr 2014 11:16:00 -0000	[thread overview]
Message-ID: <1398078987-5116-3-git-send-email-jon.turney@dronecode.org.uk> (raw)
In-Reply-To: <1398078987-5116-1-git-send-email-jon.turney@dronecode.org.uk>

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

  parent reply	other threads:[~2014-04-21 11:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-21 11:16 [PATCH setup 0/3] Setup download site list fixes Jon TURNEY
2014-04-21 11:16 ` [PATCH setup 1/3] Fix selecting sites added to the download site list box Jon TURNEY
2014-04-21 11:16 ` Jon TURNEY [this message]
2014-04-21 11:16 ` [PATCH setup 3/3] Add the last element of URL path to site chooser, if interesting Jon TURNEY
2014-04-21 14:10   ` Christopher Faylor
2014-04-21 18:12     ` Jon TURNEY
2014-04-22  7:53       ` Corinna Vinschen
2014-04-22 14:47         ` Christopher Faylor
2014-04-22 17:50           ` Jon TURNEY

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1398078987-5116-3-git-send-email-jon.turney@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=cygwin-apps@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).