diff options
author | Tim Retout <tim@retout.co.uk> | 2014-07-18 18:11:40 +0100 |
---|---|---|
committer | Tim Retout <tim@retout.co.uk> | 2014-07-18 19:06:54 +0100 |
commit | 163ffa7c4a7529ce257df72b1be392a0c0a32443 (patch) | |
tree | 6132e594184e6396cd2ca0058d585a0e8d0597ed | |
parent | 511fb0f0b5b0bf6c83c91a84633a22ae1c7cddf6 (diff) |
Allow URI schemes starting with "tor+", e.g. "tor+http://"
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | tor.cc | 12 |
3 files changed, 15 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am index 7ebcb3a..e419b94 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,4 +4,8 @@ methodsdir = $(prefix)/lib/apt/methods methods_PROGRAMS = tor tor_SOURCES = tor.cc tor.h server.cc server.h apti18n.h +install-exec-hook: + cd $(DESTDIR)$(methodsdir) && \ + $(LN_S) tor tor+http + EXTRA_DIST = README.md diff --git a/configure.ac b/configure.ac index 21f82ab..1188688 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,7 @@ AC_INIT([apt-transport-tor], [0.1], [diocles@debian.org]) AM_INIT_AUTOMAKE([-Wall -Werror foreign]) AC_PROG_CXX +AC_PROG_LN_S AC_CONFIG_HEADERS([config.h]) AC_CHECK_LIB([apt-pkg], [main]) AC_CHECK_LIB([curl], [curl_version]) @@ -151,8 +151,16 @@ bool TorMethod::Fetch(FetchItem *Itm) URI Uri = Itm->Uri; string remotehost = Uri.Host; - // Undo the "tor" at the start - Uri.Access = "http"; + // Undo any "tor" or "tor+" at the start + string prefix="tor+"; + if ("tor" == Uri.Access) + { + Uri.Access = "http"; + } + else if (!Uri.Access.compare(0, prefix.size(), prefix)) + { + Uri.Access = Uri.Access.substr(prefix.size()); + } // TODO: // - http::Pipeline-Depth |