internal override bool Initialize()
 {
     string name = base.Request.PathInfo.Substring(1);
     this.serverType = (HttpServerType) base.GetFromCache(typeof(HttpServerProtocol), base.Type);
     if (this.serverType == null)
     {
         lock (ServerProtocol.InternalSyncObject)
         {
             this.serverType = (HttpServerType) base.GetFromCache(typeof(HttpServerProtocol), base.Type);
             if (this.serverType == null)
             {
                 this.serverType = new HttpServerType(base.Type);
                 base.AddToCache(typeof(HttpServerProtocol), base.Type, this.serverType);
             }
         }
     }
     this.serverMethod = this.serverType.GetMethod(name);
     if (this.serverMethod == null)
     {
         this.serverMethod = this.serverType.GetMethodIgnoreCase(name);
         if (this.serverMethod != null)
         {
             throw new ArgumentException(Res.GetString("WebInvalidMethodNameCase", new object[] { name, this.serverMethod.name }), "methodName");
         }
         string str2 = Encoding.UTF8.GetString(Encoding.Default.GetBytes(name));
         this.serverMethod = this.serverType.GetMethod(str2);
         if (this.serverMethod == null)
         {
             throw new InvalidOperationException(Res.GetString("WebInvalidMethodName", new object[] { name }));
         }
     }
     return true;
 }
        internal override bool Initialize()
        {
            string name = base.Request.PathInfo.Substring(1);

            this.serverType = (HttpServerType)base.GetFromCache(typeof(HttpServerProtocol), base.Type);
            if (this.serverType == null)
            {
                lock (ServerProtocol.InternalSyncObject)
                {
                    this.serverType = (HttpServerType)base.GetFromCache(typeof(HttpServerProtocol), base.Type);
                    if (this.serverType == null)
                    {
                        this.serverType = new HttpServerType(base.Type);
                        base.AddToCache(typeof(HttpServerProtocol), base.Type, this.serverType);
                    }
                }
            }
            this.serverMethod = this.serverType.GetMethod(name);
            if (this.serverMethod == null)
            {
                this.serverMethod = this.serverType.GetMethodIgnoreCase(name);
                if (this.serverMethod != null)
                {
                    throw new ArgumentException(Res.GetString("WebInvalidMethodNameCase", new object[] { name, this.serverMethod.name }), "methodName");
                }
                string str2 = Encoding.UTF8.GetString(Encoding.Default.GetBytes(name));
                this.serverMethod = this.serverType.GetMethod(str2);
                if (this.serverMethod == null)
                {
                    throw new InvalidOperationException(Res.GetString("WebInvalidMethodName", new object[] { name }));
                }
            }
            return(true);
        }
Example #3
0
        internal override bool Initialize()
        {
            // The derived class better check the verb!

            string methodName = Request.PathInfo.Substring(1);   // Skip leading '/'

            if (null == (serverType = (HttpServerType)GetFromCache(typeof(HttpServerProtocol), Type)) &&
                null == (serverType = (HttpServerType)GetFromCache(typeof(HttpServerProtocol), Type, true)))
            {
                lock (InternalSyncObject)
                {
                    if (null == (serverType = (HttpServerType)GetFromCache(typeof(HttpServerProtocol), Type)) &&
                        null == (serverType = (HttpServerType)GetFromCache(typeof(HttpServerProtocol), Type, true)))
                    {
                        bool excludeSchemeHostPortFromCachingKey = this.IsCacheUnderPressure(typeof(HttpServerProtocol), Type);
                        serverType = new HttpServerType(Type);
                        AddToCache(typeof(HttpServerProtocol), Type, serverType, excludeSchemeHostPortFromCachingKey);
                    }
                }
            }

            serverMethod = serverType.GetMethod(methodName);
            if (serverMethod == null)
            {
                serverMethod = serverType.GetMethodIgnoreCase(methodName);
                if (serverMethod != null)
                {
                    throw new ArgumentException(Res.GetString(Res.WebInvalidMethodNameCase, methodName, serverMethod.name), "methodName");
                }
                else
                {
                    // it's possible that the method name came in as UTF-8 but was mangled by IIS so we try it
                    // again as UTF8...
                    string utf8MethodName = Encoding.UTF8.GetString(Encoding.Default.GetBytes(methodName));
                    serverMethod = serverType.GetMethod(utf8MethodName);
                    if (serverMethod == null)
                    {
                        throw new InvalidOperationException(Res.GetString(Res.WebInvalidMethodName, methodName));
                    }
                }
            }

            return(true);
        }
        internal override bool Initialize() {
            // The derived class better check the verb!

            string methodName = Request.PathInfo.Substring(1);   // Skip leading '/'

            if (null == (serverType = (HttpServerType)GetFromCache(typeof(HttpServerProtocol), Type))
                && null == (serverType = (HttpServerType)GetFromCache(typeof(HttpServerProtocol), Type, true)))
            {
                lock (InternalSyncObject)
                {
                    if (null == (serverType = (HttpServerType)GetFromCache(typeof(HttpServerProtocol), Type))
                        && null == (serverType = (HttpServerType)GetFromCache(typeof(HttpServerProtocol), Type, true)))
                    {
                        bool excludeSchemeHostPortFromCachingKey = this.IsCacheUnderPressure(typeof(HttpServerProtocol), Type);
                        serverType = new HttpServerType(Type);
                        AddToCache(typeof(HttpServerProtocol), Type, serverType, excludeSchemeHostPortFromCachingKey);
                    }
                }
            }

            serverMethod = serverType.GetMethod(methodName);
            if (serverMethod == null) {
                serverMethod = serverType.GetMethodIgnoreCase(methodName);
                if (serverMethod != null) 
                    throw new ArgumentException(Res.GetString(Res.WebInvalidMethodNameCase, methodName, serverMethod.name), "methodName");
                else {
                    // it's possible that the method name came in as UTF-8 but was mangled by IIS so we try it
                    // again as UTF8...
                    string utf8MethodName = Encoding.UTF8.GetString(Encoding.Default.GetBytes(methodName));
                    serverMethod = serverType.GetMethod(utf8MethodName);
                    if (serverMethod == null)
                        throw new InvalidOperationException(Res.GetString(Res.WebInvalidMethodName, methodName));
                }
            }

            return true;
        }