/// <exception cref="NGit.Transport.ServiceMayNotContinueException"></exception>
 internal virtual Repository OpenRepository(DaemonClient client, string name)
 {
     // Assume any attempt to use \ was by a Windows client
     // and correct to the more typical / used in Git URIs.
     //
     name = name.Replace('\\', '/');
     // git://thishost/path should always be name="/path" here
     //
     if (!name.StartsWith("/"))
     {
         return(null);
     }
     try
     {
         return(repositoryResolver.Open(client, Sharpen.Runtime.Substring(name, 1)));
     }
     catch (RepositoryNotFoundException)
     {
         // null signals it "wasn't found", which is all that is suitable
         // for the remote client to know.
         return(null);
     }
     catch (ServiceNotAuthorizedException)
     {
         // null signals it "wasn't found", which is all that is suitable
         // for the remote client to know.
         return(null);
     }
     catch (ServiceNotEnabledException)
     {
         // null signals it "wasn't found", which is all that is suitable
         // for the remote client to know.
         return(null);
     }
 }
Esempio n. 2
0
        /// <exception cref="System.IO.IOException"></exception>
        /// <exception cref="NGit.Transport.Resolver.ServiceNotEnabledException"></exception>
        /// <exception cref="NGit.Transport.Resolver.ServiceNotAuthorizedException"></exception>
        internal virtual void Execute(DaemonClient client, string commandLine)
        {
            string     name = Sharpen.Runtime.Substring(commandLine, command.Length + 1);
            Repository db;

            try
            {
                db = client.GetDaemon().OpenRepository(client, name);
            }
            catch (ServiceMayNotContinueException e)
            {
                // An error when opening the repo means the client is expecting a ref
                // advertisement, so use that style of error.
                PacketLineOut pktOut = new PacketLineOut(client.GetOutputStream());
                pktOut.WriteString("ERR " + e.Message + "\n");
                db = null;
            }
            if (db == null)
            {
                return;
            }
            try
            {
                if (IsEnabledFor(db))
                {
                    Execute(client, db);
                }
            }
            finally
            {
                db.Close();
            }
        }
            /// <exception cref="System.IO.IOException"></exception>
            /// <exception cref="NGit.Transport.Resolver.ServiceNotEnabledException"></exception>
            /// <exception cref="NGit.Transport.Resolver.ServiceNotAuthorizedException"></exception>
            internal override void Execute(DaemonClient dc, Repository db)
            {
                ReceivePack  rp   = this._enclosing.receivePackFactory.Create(dc, db);
                InputStream  @in  = dc.GetInputStream();
                OutputStream @out = dc.GetOutputStream();

                rp.Receive(@in, @out, null);
            }
            /// <exception cref="System.IO.IOException"></exception>
            /// <exception cref="NGit.Transport.Resolver.ServiceNotEnabledException"></exception>
            /// <exception cref="NGit.Transport.Resolver.ServiceNotAuthorizedException"></exception>
            internal override void Execute(DaemonClient dc, Repository db)
            {
                UploadPack   up   = this._enclosing.uploadPackFactory.Create(dc, db);
                InputStream  @in  = dc.GetInputStream();
                OutputStream @out = dc.GetOutputStream();

                up.Upload(@in, @out, null);
            }
        private void StartClient(Socket s)
        {
            DaemonClient dc   = new DaemonClient(this);
            EndPoint     peer = s.RemoteEndPoint;

            if (peer is IPEndPoint)
            {
                dc.SetRemoteAddress(((IPEndPoint)peer).Address);
            }
            new _Thread_335(dc, s, processors, "Git-Daemon-Client " + peer.ToString()).Start(
                );
        }
Esempio n. 6
0
        /// <exception cref="System.IO.IOException"></exception>
        /// <exception cref="NGit.Transport.Resolver.ServiceNotEnabledException"></exception>
        /// <exception cref="NGit.Transport.Resolver.ServiceNotAuthorizedException"></exception>
        internal virtual void Execute(DaemonClient client, string commandLine)
        {
            string     name = Sharpen.Runtime.Substring(commandLine, command.Length + 1);
            Repository db   = client.GetDaemon().OpenRepository(client, name);

            if (db == null)
            {
                return;
            }
            try
            {
                if (IsEnabledFor(db))
                {
                    Execute(client, db);
                }
            }
            finally
            {
                db.Close();
            }
        }
Esempio n. 7
0
			public _Thread_324(DaemonClient dc, Socket s, ThreadGroup baseArg1, string baseArg2
				) : base(baseArg1, baseArg2)
			{
				this.dc = dc;
				this.s = s;
			}
Esempio n. 8
0
		private void StartClient(Socket s)
		{
			DaemonClient dc = new DaemonClient(this);
			EndPoint peer = s.RemoteEndPoint;
			if (peer is IPEndPoint)
			{
				dc.SetRemoteAddress(((IPEndPoint)peer).Address);
			}
			new _Thread_324(dc, s, processors, "Git-Daemon-Client " + peer.ToString()).Start(
				);
		}
Esempio n. 9
0
			/// <exception cref="System.IO.IOException"></exception>
			internal override void Execute(DaemonClient dc, Repository db)
			{
				IPAddress peer = dc.GetRemoteAddress();
				string host = peer.ToString();
				if (host == null)
				{
					host = peer.GetHostAddress();
				}
				ReceivePack rp = new ReceivePack(db);
				InputStream @in = dc.GetInputStream();
				string name = "anonymous";
				string email = name + "@" + host;
				rp.SetRefLogIdent(new PersonIdent(name, email));
				rp.SetTimeout(this._enclosing.GetTimeout());
				rp.Receive(@in, dc.GetOutputStream(), null);
			}
Esempio n. 10
0
			/// <exception cref="System.IO.IOException"></exception>
			internal override void Execute(DaemonClient dc, Repository db)
			{
				UploadPack rp = new UploadPack(db);
				InputStream @in = dc.GetInputStream();
				rp.SetTimeout(this._enclosing.GetTimeout());
				rp.SetPackConfig(this._enclosing.packConfig);
				rp.Upload(@in, dc.GetOutputStream(), null);
			}
Esempio n. 11
0
 /// <exception cref="System.IO.IOException"></exception>
 /// <exception cref="NGit.Transport.Resolver.ServiceNotEnabledException"></exception>
 /// <exception cref="NGit.Transport.Resolver.ServiceNotAuthorizedException"></exception>
 internal abstract void Execute(DaemonClient client, Repository db);
 public _Thread_335(DaemonClient dc, Socket s, ThreadGroup baseArg1, string baseArg2
                    ) : base(baseArg1, baseArg2)
 {
     this.dc = dc;
     this.s  = s;
 }