ParseURL() static private method

static private ParseURL ( String url, String &objectURI ) : String
url String
objectURI String
return String
        string GetRequestUriForCurrentRequest(HttpContext context)
        {
            // we need to pull off any http specific data plus the application v-dir name
            String rawUrl = context.Request.RawUrl;
            // here's where we pull off channel info
            String channelUri;
            String requestUri;

            channelUri = HttpChannelHelper.ParseURL(rawUrl, out requestUri);
            if (channelUri == null)
            {
                requestUri = rawUrl;
            }

            // here's where we pull off the application v-dir name
            String appName = RemotingConfiguration.ApplicationName;

            if (appName != null && appName.Length > 0 && requestUri.Length > appName.Length)
            {
                //  "/appname" should always be in front, otherwise we wouldn't
                //   be in this handler.
                requestUri = requestUri.Substring(appName.Length + 1);
            }

            return(requestUri);
        }
        public BaseTransportHeaders ReadHeaders()
        {
            string str;
            string str2;
            string str3;
            string str5;
            bool   bSendContinue         = false;
            BaseTransportHeaders headers = new BaseTransportHeaders();

            this.ReadFirstLine(out str, out str2, out str3);
            if (((str == null) || (str2 == null)) || (str3 == null))
            {
                throw new RemotingException(CoreChannel.GetResourceString("Remoting_Http_UnableToReadFirstLine"));
            }
            if (str3.Equals("HTTP/1.1"))
            {
                this._version = System.Runtime.Remoting.Channels.Http.HttpVersion.V1_1;
            }
            else if (str3.Equals("HTTP/1.0"))
            {
                this._version = System.Runtime.Remoting.Channels.Http.HttpVersion.V1_0;
            }
            else
            {
                this._version = System.Runtime.Remoting.Channels.Http.HttpVersion.V1_1;
            }
            if (this._version == System.Runtime.Remoting.Channels.Http.HttpVersion.V1_1)
            {
                this._keepAlive = true;
            }
            else
            {
                this._keepAlive = false;
            }
            if (HttpChannelHelper.ParseURL(str2, out str5) == null)
            {
                str5 = str2;
            }
            headers["__RequestVerb"] = str;
            headers.RequestUri       = str5;
            headers["__HttpVersion"] = str3;
            if ((this._version == System.Runtime.Remoting.Channels.Http.HttpVersion.V1_1) && (str.Equals("POST") || str.Equals("PUT")))
            {
                bSendContinue = true;
            }
            base.ReadToEndOfHeaders(headers, out this._chunkedEncoding, out this._contentLength, ref this._keepAlive, ref bSendContinue);
            if (bSendContinue && (this._version != System.Runtime.Remoting.Channels.Http.HttpVersion.V1_0))
            {
                this.SendContinue();
            }
            headers["__IPAddress"]    = ((IPEndPoint)base.NetSocket.RemoteEndPoint).Address;
            headers["__ConnectionId"] = this._connectionId;
            return(headers);
        }
Exemplo n.º 3
0
        }         // ParseContentType

        internal static String ReplaceChannelUriWithThisString(String url, String channelUri)
        {
            // NOTE: channelUri is assumed to be scheme://machinename:port
            //   with NO trailing slash.

            String oldChannelUri;
            String objUri;

            oldChannelUri = HttpChannelHelper.ParseURL(url, out objUri);
            InternalRemotingServices.RemotingAssert(oldChannelUri != null, "http url expected.");
            InternalRemotingServices.RemotingAssert(objUri != null, "non-null objUri expected.");

            return(channelUri + objUri);
        } // ReplaceChannelUriWithThisString
Exemplo n.º 4
0
        private string GetRequestUriForCurrentRequest(HttpContext context)
        {
            string str3;
            string rawUrl = context.Request.RawUrl;

            if (HttpChannelHelper.ParseURL(rawUrl, out str3) == null)
            {
                str3 = rawUrl;
            }
            string applicationName = RemotingConfiguration.ApplicationName;

            if (((applicationName != null) && (applicationName.Length > 0)) && (str3.Length > applicationName.Length))
            {
                str3 = str3.Substring(applicationName.Length + 1);
            }
            return(str3);
        }
Exemplo n.º 5
0
 public String Parse(String url, out String objectURI)
 {
     return(HttpChannelHelper.ParseURL(url, out objectURI));
 } // Parse
 public string Parse(string url, out string objectURI)
 {
     return(HttpChannelHelper.ParseURL(url, out objectURI));
 }
Exemplo n.º 7
0
        } // ValidateVerbCharacter

        // read headers
        public BaseTransportHeaders ReadHeaders()
        {
            bool bSendContinue = false;

            BaseTransportHeaders headers = new BaseTransportHeaders();

            // read first line
            String verb, requestURI, version;

            ReadFirstLine(out verb, out requestURI, out version);

            if ((verb == null) || (requestURI == null) || (version == null))
            {
                throw new RemotingException(
                          CoreChannel.GetResourceString(
                              "Remoting_Http_UnableToReadFirstLine"));
            }

            if (version.Equals("HTTP/1.1")) // most common case
            {
                _version = HttpVersion.V1_1;
            }
            else
            if (version.Equals("HTTP/1.0"))
            {
                _version = HttpVersion.V1_0;
            }
            else
            {
                _version = HttpVersion.V1_1; // (assume it will understand 1.1)
            }
            if (_version == HttpVersion.V1_1)
            {
                _allowChunkedResponse = true;
                _keepAlive            = true;
            }
            else // it's a 1.0 client
            {
                _allowChunkedResponse = false;
                _keepAlive            = false;
            }


            // update request uri to be sure that it has no channel data
            String channelURI;
            String objectURI;

            channelURI = HttpChannelHelper.ParseURL(requestURI, out objectURI);
            if (channelURI == null)
            {
                objectURI = requestURI;
            }

            headers["__RequestVerb"] = verb;
            headers.RequestUri       = objectURI;
            headers["__HttpVersion"] = version;

            // check to see if we must send continue
            if ((_version == HttpVersion.V1_1) &&
                (verb.Equals("POST") || verb.Equals("PUT")))
            {
                bSendContinue = true;
            }

            ReadToEndOfHeaders(headers, out _chunkedEncoding, out _contentLength,
                               ref _keepAlive, ref bSendContinue);

            if (bSendContinue && (_version != HttpVersion.V1_0))
            {
                SendContinue();
            }

            // add IP address and Connection Id to headers
            headers[CommonTransportKeys.IPAddress]    = ((IPEndPoint)NetSocket.RemoteEndPoint).Address;
            headers[CommonTransportKeys.ConnectionId] = _connectionId;

            return(headers);
        } // ReadHeaders