public XmlRpcBasicDOSProtector(XmlRpcMethod normalMethod, XmlRpcMethod throttledMethod, BasicDosProtectorOptions options)
        {
            _normalMethod    = normalMethod;
            _throttledMethod = throttledMethod;

            _options      = options;
            _dosProtector = new BasicDOSProtector(_options);
        }
 /// <summary>
 /// Instantiate an XmlRpc handler.
 /// </summary>
 /// <param name="handler">XmlRpcMethod
 /// delegate</param>
 /// <param name="methodName">XmlRpc method name</param>
 /// <param name="path">XmlRpc path prefix (regular expression)</param>
 /// <param name="headers">Dictionary with header names and
 /// regular expressions to match content of headers</param>
 /// <param name="whitelist">IP whitelist of remote end points
 /// to accept (regular expression)</param>
 /// <remarks>
 /// Except for handler and methodName, all other parameters
 /// can be null, in which case they are not taken into account
 /// when the handler is being looked up.
 /// </remarks>
 public OSHttpXmlRpcHandler(XmlRpcMethod handler, string methodName, Regex path,
                            Dictionary <string, Regex> headers, Regex whitelist)
     : base(new Regex(@"^POST$", RegexOptions.IgnoreCase | RegexOptions.Compiled), path, null, headers,
            new Regex(@"^(text|application)/xml", RegexOptions.IgnoreCase | RegexOptions.Compiled),
            whitelist)
 {
     _handler    = handler;
     _methodName = methodName;
 }
Ejemplo n.º 3
0
        public XmlRpcBasicDOSProtector(XmlRpcMethod normalMethod, XmlRpcMethod throttledMethod,BasicDosProtectorOptions options)
        {
            _normalMethod = normalMethod;
            _throttledMethod = throttledMethod;
           
            _options = options;
            _dosProtector = new BasicDOSProtector(_options);

        }
Ejemplo n.º 4
0
        // Returns a XmlRpcMethod object from the incoming stream
        public object Deserialize(Stream stream)
        {
            XmlTextReader tr     = new XmlTextReader(stream);
            XmlRpcMethod  method = new XmlRpcMethod();

            method.Read(tr);

            return(method);
        }
Ejemplo n.º 5
0
        public bool AddXmlRPCHandler(string method, XmlRpcMethod handler)
        {
            if (!this.m_rpcHandlers.ContainsKey(method))
            {
                this.m_rpcHandlers.Add(method, handler);
                return true;
            }

            //must already have a handler for that path so return false
            return false;
        }
 public ReflectiveXmlRpcHandler(AbstractReflectiveHandlerMapping mapping, ITypeConverterFactory typeConverterFactory, Type type, IXmlRpcTargetProvider provider, MethodInfo[] methods)
 {
     _mapping = mapping;
     _type = type;
     _methods = new XmlRpcMethod[methods.Length];
     for (Int32 i = 0; i < methods.Length; i++)
     {
         _methods[i] = new XmlRpcMethod(methods[i], typeConverterFactory);
     }
     _targetProvider = provider;
 }
Ejemplo n.º 7
0
        public bool AddXmlRPCHandler(string method, XmlRpcMethod handler)
        {
            if (!this.m_rpcHandlers.ContainsKey(method))
            {
                this.m_rpcHandlers.Add(method, handler);
                return(true);
            }

            //must already have a handler for that path so return false
            return(false);
        }
Ejemplo n.º 8
0
 public ReflectiveXmlRpcHandler(AbstractReflectiveHandlerMapping mapping, ITypeConverterFactory typeConverterFactory, Type type, IXmlRpcTargetProvider provider, MethodInfo[] methods)
 {
     _mapping = mapping;
     _type    = type;
     _methods = new XmlRpcMethod[methods.Length];
     for (Int32 i = 0; i < methods.Length; i++)
     {
         _methods[i] = new XmlRpcMethod(methods[i], typeConverterFactory);
     }
     _targetProvider = provider;
 }
Ejemplo n.º 9
0
        public Object Execute(IXmlRpcRequest request)
        {
            if (_mapping.AuthenticationHandler != null && !_mapping.AuthenticationHandler.IsAuthorized(request))
            {
                throw new XmlRpcException("Not authorized");
            }

            Object[]     args   = request.Parameters ?? Empty;
            XmlRpcMethod method = GetMethod(args);

            ConvertParams(method.TypeConverters, args);
            //return Invoke(method.Method, _targetProvider == null ? request.Target : _targetProvider.GetTarget(request), request.Parameters);
            if (request.Target == null && _targetProvider != null)
            {
                request.Target = _targetProvider.GetTarget(request);
            }
            return(Invoke(method.Method, request.Target, args));
        }
 public bool AddXmlRPCHandler(string method, XmlRpcMethod handler)
 {
     lock (m_rpcHandlers)
         m_rpcHandlers[method] = handler;
     return true;
 }
Ejemplo n.º 11
0
 internal bool TryGetXMLHandler(string methodName, out XmlRpcMethod handler)
 {
     lock (m_rpcHandlers)
         return m_rpcHandlers.TryGetValue(methodName, out handler);
 }
Ejemplo n.º 12
0
 public bool AddXmlRPCHandler(string method, XmlRpcMethod handler)
 {
     lock (m_rpcHandlers)
         m_rpcHandlers[method] = handler;
     return(true);
 }
Ejemplo n.º 13
0
 public XmlRpcStreamHandler(string httpMethod, string path, XmlRpcMethod xmlrpcMethod) : base(httpMethod, path)
 {
     m_xmlrpcMethod = xmlrpcMethod;
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Instantiate an XmlRpc handler.
 /// </summary>
 /// <param name="handler">XmlRpcMethod
 /// delegate</param>
 /// <param name="methodName">XmlRpc method name</param>
 public OSHttpXmlRpcHandler(XmlRpcMethod handler, string methodName)
     : this(handler, methodName, null, null, null)
 {
 }
Ejemplo n.º 15
0
 public bool AddXmlRPCHandler(string method, XmlRpcMethod handler)
 {
     return AddXmlRPCHandler(method, handler, true);
 }
Ejemplo n.º 16
0
 internal bool TryGetXMLHandler(string methodName, out XmlRpcMethod handler)
 {
     lock (m_rpcHandlers)
         return(m_rpcHandlers.TryGetValue(methodName, out handler));
 }
 /// <summary>
 /// Instantiate an XmlRpc handler.
 /// </summary>
 /// <param name="handler">XmlRpcMethod
 /// delegate</param>
 /// <param name="methodName">XmlRpc method name</param>
 public OSHttpXmlRpcHandler(XmlRpcMethod handler, string methodName)
     : this(handler, methodName, null, null, null)
 {
 }
Ejemplo n.º 18
0
 public XmlRpcStreamHandler(string httpMethod, string path, XmlRpcMethod xmlrpcMethod) : base(httpMethod, path)
 {
     m_xmlrpcMethod = xmlrpcMethod;
 }
Ejemplo n.º 19
0
        public bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive)
        {
            lock (m_rpcHandlers)
            {
                m_rpcHandlers[method] = handler;
                m_rpcHandlersKeepAlive[method] = keepAlive; // default
            }

            return true;
        }
Ejemplo n.º 20
0
 /// <summary>
 /// Instantiate an XmlRpc handler.
 /// </summary>
 /// <param name="handler">XmlRpcMethod
 /// delegate</param>
 /// <param name="methodName">XmlRpc method name</param>
 /// <param name="path">XmlRpc path prefix (regular expression)</param>
 /// <param name="headers">Dictionary with header names and
 /// regular expressions to match content of headers</param>
 /// <param name="whitelist">IP whitelist of remote end points
 /// to accept (regular expression)</param>
 /// <remarks>
 /// Except for handler and methodName, all other parameters
 /// can be null, in which case they are not taken into account
 /// when the handler is being looked up.
 /// </remarks>
 public OSHttpXmlRpcHandler(XmlRpcMethod handler, string methodName, Regex path,
                            Dictionary<string, Regex> headers, Regex whitelist)
     : base(new Regex(@"^POST$", RegexOptions.IgnoreCase | RegexOptions.Compiled), path, null, headers,
            new Regex(@"^(text|application)/xml", RegexOptions.IgnoreCase | RegexOptions.Compiled),
            whitelist)
 {
     _handler = handler;
     _methodName = methodName;
 }