This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/4] Canonicalize mirror URLs to ensure they end with a '/'


This prevents a mirror URL being added twice (with and without a terminal '/')

This ensures that the download directory is consistently named, avoiding
downloading everything again, even if an additional mirror URL is added
in a form which differs in the presence of a terminal '/' from last time.

2010-11-26  Jon TURNEY <jon.turney@dronecode.org.uk>

	* site.cc (init): Canonicalize mirror URLs to ensure the end
	with a '/'.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
---
 site.cc |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/site.cc b/site.cc
index 42839f3..ff617b5 100644
--- a/site.cc
+++ b/site.cc
@@ -141,6 +141,10 @@ site_list_type::init (const string &_url, const string &_servername,
   area = _area;
   location = _location;
 
+  /* Canonicalize URL to ensure it ends with a '/' */
+  if (url.at(url.length()-1) != '/')
+    url.append("/");
+
   /* displayed_url is protocol and site name part of url */
   string::size_type path_offset = url.find ("/", url.find ("//") + 2);
   displayed_url = url.substr(0, path_offset);
-- 
1.7.2.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]