This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
Re: [PATCH 2/4] Canonicalize mirror URLs to ensure they end with a '/'
On Nov 26 13:48, Jon TURNEY wrote:
> 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);
> --
Looks good, please apply.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat