aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/mod-ci.cxx17
-rw-r--r--mod/mod-package-version-details.cxx2
-rw-r--r--mod/options.cli6
-rw-r--r--mod/types-parsers.cxx8
-rw-r--r--mod/types-parsers.hxx6
5 files changed, 14 insertions, 25 deletions
diff --git a/mod/mod-ci.cxx b/mod/mod-ci.cxx
index e16a1a1..e0b35dd 100644
--- a/mod/mod-ci.cxx
+++ b/mod/mod-ci.cxx
@@ -222,23 +222,12 @@ handle (request& rq, response& rs)
return true;
}
- // Parse and verify the remote repository location.
+ // Verify the remote repository location.
//
- repository_location rl;
+ const repository_location rl (params.repository ());
- try
- {
- const repository_url& u (params.repository ());
-
- if (u.empty () || u.scheme == repository_protocol::file)
- throw invalid_argument ("");
-
- rl = repository_location (u, guess_type (u, false /* local */));
- }
- catch (const invalid_argument&)
- {
+ if (rl.empty () || rl.local ())
return respond_manifest (400, "invalid repository location");
- }
// Verify the package name[/version] arguments.
//
diff --git a/mod/mod-package-version-details.cxx b/mod/mod-package-version-details.cxx
index f9d346e..bafe8f7 100644
--- a/mod/mod-package-version-details.cxx
+++ b/mod/mod-package-version-details.cxx
@@ -208,7 +208,7 @@ handle (request& rq, response& rs)
{
assert (pkg->location);
- s << TR_DOWNLOAD (rl.string () + "/" + pkg->location->string ());
+ s << TR_DOWNLOAD (rl.url ().string () + "/" + pkg->location->string ());
}
if (pkg->fragment)
diff --git a/mod/options.cli b/mod/options.cli
index c78af73..8020f95 100644
--- a/mod/options.cli
+++ b/mod/options.cli
@@ -2,7 +2,7 @@
// copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-include <libbpkg/manifest.hxx>; // repository_url
+include <libbpkg/manifest.hxx>; // repository_location
include <web/xhtml-fragment.hxx>;
@@ -765,12 +765,12 @@ namespace brep
//
class ci
{
- // Package repository URL.
+ // Package repository location.
//
// Note that the ci parameter is renamed to '_' by the root handler (see
// the request_proxy class for details).
//
- bpkg::repository_url repository | _;
+ bpkg::repository_location repository | _;
// Package names/versions.
//
diff --git a/mod/types-parsers.cxx b/mod/types-parsers.cxx
index e40a777..1467bf6 100644
--- a/mod/types-parsers.cxx
+++ b/mod/types-parsers.cxx
@@ -51,10 +51,10 @@ namespace brep
parse_path (x, s);
}
- // Parse repository_url.
+ // Parse repository_location.
//
- void parser<repository_url>::
- parse (repository_url& x, bool& xs, scanner& s)
+ void parser<repository_location>::
+ parse (repository_location& x, bool& xs, scanner& s)
{
xs = true;
@@ -67,7 +67,7 @@ namespace brep
try
{
- x = repository_url (v);
+ x = repository_location (v);
}
catch (const invalid_argument&)
{
diff --git a/mod/types-parsers.hxx b/mod/types-parsers.hxx
index 36128d9..87ea8ed 100644
--- a/mod/types-parsers.hxx
+++ b/mod/types-parsers.hxx
@@ -8,7 +8,7 @@
#ifndef MOD_TYPES_PARSERS_HXX
#define MOD_TYPES_PARSERS_HXX
-#include <libbpkg/manifest.hxx> // repository_url
+#include <libbpkg/manifest.hxx> // repository_location
#include <web/xhtml-fragment.hxx>
@@ -41,10 +41,10 @@ namespace brep
};
template <>
- struct parser<bpkg::repository_url>
+ struct parser<bpkg::repository_location>
{
static void
- parse (bpkg::repository_url&, bool&, scanner&);
+ parse (bpkg::repository_location&, bool&, scanner&);
};
template <>