diff options
author | James Moger <james.moger@gitblit.com> | 2013-05-03 19:06:50 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-05-03 19:09:25 -0400 |
commit | 40aa84507640cd2a980757e7910a63310474eb87 (patch) | |
tree | 088278936eb8722e4f162f2b77b91bbbffaeec87 /src/main/java/com/gitblit/git/GitblitReceivePackFactory.java | |
parent | 9985ed23ae251c1d024a223f9ea8372b75a122f2 (diff) | |
download | gitblit-40aa84507640cd2a980757e7910a63310474eb87.tar.gz gitblit-40aa84507640cd2a980757e7910a63310474eb87.zip |
Revised Git Daemon to improve thread stopping and to eliminate repository name hack
Diffstat (limited to 'src/main/java/com/gitblit/git/GitblitReceivePackFactory.java')
-rw-r--r-- | src/main/java/com/gitblit/git/GitblitReceivePackFactory.java | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/main/java/com/gitblit/git/GitblitReceivePackFactory.java b/src/main/java/com/gitblit/git/GitblitReceivePackFactory.java index 8b8ef0e4..77a3df63 100644 --- a/src/main/java/com/gitblit/git/GitblitReceivePackFactory.java +++ b/src/main/java/com/gitblit/git/GitblitReceivePackFactory.java @@ -19,7 +19,6 @@ import javax.servlet.http.HttpServletRequest; import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.Repository; -import org.eclipse.jgit.transport.DaemonClient; import org.eclipse.jgit.transport.ReceivePack; import org.eclipse.jgit.transport.resolver.ReceivePackFactory; import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException; @@ -50,18 +49,15 @@ public class GitblitReceivePackFactory<X> implements ReceivePackFactory<X> { final ReceivePack rp = new ReceivePack(db); UserModel user = UserModel.ANONYMOUS; + String repositoryName = ""; String origin = ""; String gitblitUrl = ""; int timeout = 0; - // XXX extract the repository name from the config - // the name is injected by GitRepositoryResolver - String repositoryName = db.getConfig().getString("gitblit", null, "repositoryName"); - - if (req instanceof HttpServletRequest) { // http/https request may or may not be authenticated HttpServletRequest request = (HttpServletRequest) req; + repositoryName = request.getAttribute("gitblitRepositoryName").toString(); origin = request.getRemoteHost(); gitblitUrl = HttpUtils.getGitblitURL(request); @@ -74,9 +70,10 @@ public class GitblitReceivePackFactory<X> implements ReceivePackFactory<X> { user = new UserModel(username); } } - } else if (req instanceof DaemonClient) { + } else if (req instanceof GitDaemonClient) { // git daemon request is alway anonymous - DaemonClient client = (DaemonClient) req; + GitDaemonClient client = (GitDaemonClient) req; + repositoryName = client.getRepositoryName(); origin = client.getRemoteAddress().getHostAddress(); // set timeout from Git daemon timeout = client.getDaemon().getTimeout(); |