protected override void OnSessionClose(object ctx, CodeFluent.Runtime.BinaryServices.Session session)
        {
            if (ctx == null)
            {
                throw new System.ArgumentNullException("ctx");
            }

            if (session == null)
            {
                throw new System.ArgumentNullException("session");
            }

            if (!OnSessionChange(session, CodeFluent.Runtime.BinaryServices.SessionChangeType.Closing, ctx, true, null))
            {
                return;
            }

            System.Net.HttpListenerContext context = (System.Net.HttpListenerContext)ctx;

            string entityTypeName;
            string propertyName;
            string entityKey;

            ParseUri(context.Request.Url, out entityTypeName, out propertyName, out entityKey);
            OnSessionClose(context, session, entityTypeName, propertyName, entityKey);
            OnSessionChange(session, CodeFluent.Runtime.BinaryServices.SessionChangeType.Closed, ctx, false, null);
        }
示例#2
0
        public AspTappet(System.Net.HttpListenerContext context, string vdir, string pdir, bool enableLogging = true)
        {
            if (null == context)
                throw new ArgumentNullException("context");
            if (string.IsNullOrWhiteSpace(vdir))
                throw new ArgumentException("vdir");
            if (string.IsNullOrWhiteSpace(pdir))
                throw new ArgumentException("pdir");

            _context = context;
            _virtualDir = vdir;
            _physicalDir = pdir;
            //Path.Combine don't work in these here parts...
            if (_physicalDir.EndsWith(@"\"))
                _physicalDir = _physicalDir.Substring(0, _physicalDir.Length - 1);
            _traceId = Guid.NewGuid();
            _enableLogging = enableLogging;

            try
            {
                if(_aspPipelineExtensions == null)
                    _aspPipelineExtensions = GetGlobalWebConfigAspExtensions();
            }
            catch (Exception ex)
            {
                Log.Write("error while trying to get machine-level web config");
                Log.ExceptionLogging(ex);
            }
        }
示例#3
0
        private void handle_metaWeblog_editPost(System.Net.HttpListenerContext context, MP.XmlRpc.MethodCall methodcall)
        {
            this.WriteLogMethodName();

            var postid   = (MP.XmlRpc.StringValue)methodcall.Parameters[0];
            var username = (MP.XmlRpc.StringValue)methodcall.Parameters[1];
            var password = (MP.XmlRpc.StringValue)methodcall.Parameters[2];
            var struct_  = (MP.XmlRpc.Struct)methodcall.Parameters[3];
            var publish  = (MP.XmlRpc.BooleanValue)methodcall.Parameters[4];

            this.AuthenicateUser(username.String, password.String);

            this.WriteLog("PostId = {0}", postid.String);
            this.WriteLog("Username = {0}", username.String);
            this.WriteLog("Publish = {0}", publish.Boolean);

            // Post was found
            var post_title       = struct_.Get <MP.XmlRpc.StringValue>("title", null);
            var post_description = struct_.Get <MP.XmlRpc.StringValue>("description", null);
            var post_categories  = struct_.Get <MP.XmlRpc.Array>("categories", null);

            var cats = GetCategoriesFromArray(post_categories);

            this.PostList.Edit(postid.String, null, post_title.String, post_description.String, cats, publish.Boolean);

            var method_response = new MP.XmlRpc.MethodResponse();

            method_response.Parameters.Add(true); // this is supposed to always return true
            WriteResponseString(context, method_response.CreateDocument().ToString(), 200, "text/xml");
        }
示例#4
0
        private void handle_metaWeblog_deletePost(System.Net.HttpListenerContext context, MP.XmlRpc.MethodCall methodcall)
        {
            this.WriteLogMethodName();

            var appkey   = (MP.XmlRpc.StringValue)methodcall.Parameters[0];
            var postid   = (MP.XmlRpc.StringValue)methodcall.Parameters[1];
            var username = (MP.XmlRpc.StringValue)methodcall.Parameters[2];
            var password = (MP.XmlRpc.StringValue)methodcall.Parameters[3];

            this.WriteLog("AppKey = {0}", postid.String);
            this.WriteLog("PostId = {0}", postid.String);
            this.WriteLog("Username = {0}", username.String);

            var post = this.PostList.TryGetPostById(postid.String);

            if (post == null)
            {
                this.WriteLog("No such Post with ID {0}", postid.String);
                // Post was not found
                respond_error_invalid_postid_parameter(context, 404);
                return;
            }

            // Post was found
            this.WriteLog("Found Post with ID {0}", postid.String);
            this.PostList.Delete(post.Value);

            var method_response = new MP.XmlRpc.MethodResponse();

            method_response.Parameters.Add(true); // this is supposed to always return true
            WriteResponseString(context, method_response.CreateDocument().ToString(), 200, "text/xml");
        }
示例#5
0
        private void handle_metaWeblog_newPost(System.Net.HttpListenerContext context, MP.XmlRpc.MethodCall methodcall)
        {
            this.WriteLogMethodName();

            var blogid   = (MP.XmlRpc.StringValue)methodcall.Parameters[0];
            var username = (MP.XmlRpc.StringValue)methodcall.Parameters[1];
            var password = (MP.XmlRpc.StringValue)methodcall.Parameters[2];

            this.WriteLog("BlogId = {0}", blogid.String);
            this.WriteLog("Username = {0}", username.String);

            this.AuthenicateUser(username.String, password.String);

            var struct_    = (MP.XmlRpc.Struct)methodcall.Parameters[3];
            var publish    = (MP.XmlRpc.BooleanValue)methodcall.Parameters[4];
            var post_title = struct_.Get <MP.XmlRpc.StringValue>("title").String;


            var post_description = struct_.Get <MP.XmlRpc.StringValue>("description");
            var post_categories  = struct_.Get <MP.XmlRpc.Array>("categories", null);

            var cats = GetCategoriesFromArray(post_categories);

            this.WriteLog(" Categories {0}", string.Join(",", cats));
            var new_post = this.PostList.Add(null, post_title, post_description.String, cats, publish.Boolean);

            var method_response = new MP.XmlRpc.MethodResponse();

            method_response.Parameters.Add(new_post.PostId);

            this.WriteLog("New Post Created with ID = {0}", new_post.PostId);
            WriteResponseString(context, method_response.CreateDocument().ToString(), 200, "text/xml");
        }
示例#6
0
        public override bool load(StringBuilder sb, Permissions permissions, System.Net.HttpListenerContext context)
        {
            if (!base.load(sb, permissions, context))
            {
                return(false);
            }

            if (!permissions.HasFlag(Permissions))
            {
                AppendNoRights(sb);
                return(true);
            }

            sb.AppendLine("<h2>Log:</h2><br>");
            sb.AppendLine("\t\t<div class=\"content\">");
            try
            {
                sb.AppendLine(File.ReadAllText("serverlog.html"));
            }
            catch (Exception ex) { }
            sb.AppendLine("\t\t</div>");


            return(true);
        }
示例#7
0
        private void handle_metaWeblog_getPost(System.Net.HttpListenerContext context, MP.XmlRpc.MethodCall methodcall)
        {
            this.WriteLogMethodName();

            var postid   = (MP.XmlRpc.StringValue)methodcall.Parameters[0];
            var username = (MP.XmlRpc.StringValue)methodcall.Parameters[1];
            var password = (MP.XmlRpc.StringValue)methodcall.Parameters[2];

            this.AuthenicateUser(username.String, password.String);

            this.WriteLog("PostId = {0}", postid.String);
            this.WriteLog("Username = {0}", username.String);

            var post = this.PostList.TryGetPostById(postid.String);

            if (post == null)
            {
                // Post was not found
                respond_error_invalid_postid_parameter(context, 200);
                return;
            }

            // Post was found
            respond_post(context, post.Value);
        }
        private void handle_media(System.Net.HttpListenerContext context)
        {
            this.WriteLogMethodName();
            var mo = this.MediaObjectList.TryGetMediaObjectByUrl(context.Request.Url.AbsolutePath + context.Request.Url.Query);

            if (mo == null)
            {
                handle_404_not_found(context);
                return;
            }

            var m = mo.Value;


            var bytes = System.Convert.FromBase64String(m.Base64Bits);

            context.Response.StatusCode      = 200;
            context.Response.KeepAlive       = false;
            context.Response.ContentLength64 = bytes.Length;

            var output = context.Response.OutputStream;

            output.Write(bytes, 0, bytes.Length);
            context.Response.Close();
        }
示例#9
0
        protected override long OnDownload(object ctx, long start, long end)
        {
            if (ctx == null)
            {
                throw new System.ArgumentNullException("ctx");
            }

            System.Net.HttpListenerContext context = (System.Net.HttpListenerContext)ctx;
            string entityTypeName;
            string propertyName;
            string entityKey;

            ParseUri(context.Request.Url, out entityTypeName, out propertyName, out entityKey);

            if (entityTypeName == "ContactManager.User")
            {
                if (propertyName == "Photo")
                {
                    ContactManager.User entity = ContactManager.User.LoadByEntityKey(entityKey);
                    if (entity != null)
                    {
                        return(OnDownload(context, entity.Photo, start, end));
                    }
                    throw new System.InvalidOperationException(ContactManager.Resources.Manager.GetStringWithDefault("bitsServerEntityNotFound", "Entity of type '{0}' with entity key '{1}' was not found.", new object[] { entityTypeName, entityKey }));
                }
            }

            throw new System.InvalidOperationException(ContactManager.Resources.Manager.GetStringWithDefault("bitsServerInvalidUrl", "Invalid url '{0}'.", new object[] { context.Request.Url }));
        }
示例#10
0
        /// <summary>
        /// Gets the session identity.
        /// </summary>
        /// <returns>The session identity.</returns>
        /// <param name="ctx">Context.</param>
        public static CustomSessionIdentity GetSessionIdentity(System.Net.HttpListenerContext ctx)
        {
            CustomSessionIdentity ret;

            System.Net.CookieCollection coll = ctx.Request.Cookies;

            if (coll[RESTKeys.SessionCookieId] == null ||
                string.IsNullOrEmpty(coll[RESTKeys.SessionCookieId].Value))
            {
                //needs a new identity
                ret = CustomSessionIdentity.CreateNew();
            }
            else if (coll[RESTKeys.SessionCookieId].Expired)
            {
                //needs a new identity
                ret = CustomSessionIdentity.CreateNew();
            }
            else
            {
                //needs an existing identity
                ret = CustomSessionIdentity.Retrieve(coll[RESTKeys.SessionCookieId].Value,
                                                     coll[RESTKeys.SessionCookieToken].Value);
            }
            foreach (System.Net.Cookie c in ret.GetCookies())
            {
                ctx.Response.Cookies.Add(c);
            }
            ret.ctx = ctx;
            return(ret);
        }
示例#11
0
文件: Program.cs 项目: starkeeny/CSSE
        public static System.Net.HttpListener StartScriptLogicAsRest(string serviceParameter, Func <object> func)
        {
            var listener = new System.Net.HttpListener();

            listener.Prefixes.Add(string.Format("http://localhost:4567/{0}/", System.Diagnostics.Process.GetCurrentProcess().ProcessName));
            listener.Start();

            while (true)
            {
                System.Net.HttpListenerContext  context  = listener.GetContext();
                System.Net.HttpListenerRequest  request  = context.Request;
                System.Net.HttpListenerResponse response = context.Response;

                string responseString = func().ToString();
                byte[] buffer         = System.Text.Encoding.UTF8.GetBytes(responseString);

                // Get a response stream and write the response to it.
                response.ContentLength64 = buffer.Length;
                System.IO.Stream output = response.OutputStream;
                output.Write(buffer, 0, buffer.Length);

                // You must close the output stream.
                output.Close();
            }
            return(listener);
        }
示例#12
0
        public ServerAsynchronous(string[] prefixes)
        {
            System.Net.HttpListener listener = new System.Net.HttpListener();

            foreach (string prefix in prefixes)
            {
                listener.Prefixes.Add(prefix);
            }

            this.RequestHandler = this.RequestHandlerDefault;

            listener.Start();

            while (this.IsRunning)
            {
                try
                {
                    System.Net.HttpListenerContext context = listener.GetContext();
                    System.Threading.ThreadPool.QueueUserWorkItem
                    (
                        o => RequestHandler(context)
                    );
                }
                catch (Exception exc)
                {
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    sb.Append($"ServerAsynchronous error");

                    throw new InvalidOperationException(sb.ToString(), exc);
                }
            }

            return;
        }
 /// <summary>
 /// Ответ по умолчанию
 /// </summary>
 /// <param name="ctx">Объект запроса</param>
 /// <returns></returns>
 private ActionResult DefaultResponce(System.Net.HttpListenerContext ctx)
 {
     ctx.Response.Redirect(_procesName);
     return(new ActionResult {
         Content = new byte[0]
     });
 }
示例#14
0
        /// <summary>
        /// Http listener context member.
        /// </summary>
        /// <param name="context">Provides access to the request and response objects used
        /// by the System.Net.HttpListener class. This class cannot be inherited.</param>
        public HttpListenerContextMember(System.Net.HttpListenerContext context)
        {
            _context = context;

            // Set the initial timeout time.
            _initialTimeOutTime = DateTime.Now;
        }
        protected override void OnInformation(object ctx)
        {
            if (ctx == null)
            {
                throw new System.ArgumentNullException("ctx");
            }

            System.Net.HttpListenerContext context = (System.Net.HttpListenerContext)ctx;
            string entityTypeName;
            string propertyName;
            string entityKey;

            ParseUri(context.Request.Url, out entityTypeName, out propertyName, out entityKey);

            if (entityTypeName == "SoftFluent.Samples.ComponentOne.User")
            {
                if (propertyName == "Photo")
                {
                    SoftFluent.Samples.ComponentOne.User entity = SoftFluent.Samples.ComponentOne.User.LoadByEntityKey(entityKey);
                    if (entity != null)
                    {
                        OnInformation(context, entity.Photo);
                        return;
                    }
                    throw new System.InvalidOperationException(SoftFluent.Samples.ComponentOne.Resources.Manager.GetStringWithDefault("bitsServerEntityNotFound", "Entity of type '{0}' with entity key '{1}' was not found.", new object[] { entityTypeName, entityKey }));
                }
            }

            throw new System.InvalidOperationException(SoftFluent.Samples.ComponentOne.Resources.Manager.GetStringWithDefault("bitsServerInvalidUrl", "Invalid url '{0}'.", new object[] { context.Request.Url }));
        }
        private void handle_post(System.Net.HttpListenerContext context)
        {
            this.WriteLogMethodName();
            var tokens = context.Request.Url.AbsolutePath.Split(new char[] { '/' });

            string post_link = context.Request.Url.AbsolutePath;

            WriteLog("postlink = {0}", post_link);

            var thepost = this.PostList.TryGetPostByLink(post_link);

            if (thepost == null)
            {
                handle_404_not_found(context);
                return;
            }

            var xdoc        = CreateHtmlDom();
            var el_body     = xdoc.Element("html").ElementSafe("body");
            var el_div_post = GetPostContentElement(thepost.Value);

            el_body.Add(el_div_post);

            string html = xdoc.ToString();

            html = html.Replace(GetReplacementString(thepost.Value), thepost.Value.Description);
            WriteResponseString(context, html, 200, ContentType_TextXml);
        }
示例#17
0
        public ReturnCode ProcessRequest(System.Net.HttpListenerContext context)
        {
            UrlHelper     urlHelper = new UrlHelper(context.Request.Url);
            CommandResult result    = urlHelper.ParseResult;

            if (urlHelper.ParseResult == CommandResult.Success)
            {
                try
                {
                    _luaScriptEngineer.ExecuteScript(urlHelper.ScriptName, urlHelper.Parameters);
                    return(new ReturnCode((int)CommandResult.Success, EnumHelper.GetEnumDescription(CommandResult.Success)));
                }
                catch (FileNotFoundException fileNotFoundException)
                {
                    return(new ReturnCode((int)CommandResult.NoExistsMethod, EnumHelper.GetEnumDescription(CommandResult.NoExistsMethod)));
                }
                catch (ReturnCode returnCode)
                {
                    return(returnCode);
                }
                catch (Exception ex)
                {
                    return(new ReturnCode((int)CommandResult.ExcuteFunctionFailed, EnumHelper.GetEnumDescription(CommandResult.ExcuteFunctionFailed)));
                }
            }
            return(new ReturnCode((int)result, EnumHelper.GetEnumDescription(result)));
        }
示例#18
0
        public override void Start(System.Net.HttpListenerContext context)
        {
            Logger.LogDebug("Starting sdb web site");

            XmlDocument options = context.GetRequestDataAsXml();

            int start_port = MonoToolsConfigurationManager.ApplicationPortRangeStart;
            int end_port   = MonoToolsConfigurationManager.ApplicationPortRangeEnd;

            host = context.Request.LocalEndPoint.Address;

            for (sdb_port = start_port; sdb_port <= end_port; sdb_port++)
            {
                Logger.LogDebug("  Trying to start with sdb port: {0}", sdb_port);
                XspSession session = StartXspSession(options);

                if (session == null)
                {
                    Logger.LogDebug("    sdb on port {0} failed", sdb_port);
                    continue;
                }

                Logger.LogDebug("    sdb port {0} is good, returning to VS", sdb_port);
                is_started = true;
                context.WriteString(ToXml());
                return;
            }

            Logger.LogDebug("    Ran out of sdb ports to use: {0}-{1}.", start_port, end_port);

            context.ReturnException(new ApplicationException("Could not find an available sdb port to use."));
        }
        private void handle_category(System.Net.HttpListenerContext context)
        {
            var tokens = context.Request.Url.AbsolutePath.Split(new char[] { '/' });

            this.WriteLogMethodName();

            var xdoc     = this.CreateHtmlDom();
            var el_body  = xdoc.Element("html").Element("body");
            var el_title = el_body.AddH1Element("Debug Page");

            el_body.AddH1Element("Posts");

            foreach (var post in this.PostList)
            {
                var cats = BlogServer.split_cat_strings(post.Categories);
                if (cats.Contains(tokens[tokens.Length - 1]))
                {
                    el_body.AddParagraphElement(string.Format("Title=\"{0}\"", post.Title));
                    el_body.AddParagraphElement(string.Format("Link=\"{0}\"", post.Link));
                }
            }

            string html = xdoc.ToString();

            WriteResponseString(context, html, 200, ContentType_TextHtml);
        }
        private void handle_blog_home_page(System.Net.HttpListenerContext context)
        {
            this.WriteLogMethodName();

            var xdoc     = this.CreateHtmlDom();
            var el_body  = xdoc.Element("html").Element("body");
            var el_title = el_body.AddH1Element(this.BlogTitle);

            var el_para0 = el_body.AddParagraphElement();

            el_para0.AddAnchorElement("/archive", "Archive");

            foreach (var cat in this.CategoryList)
            {
                var p = el_body.AddParagraphElement();
                p.AddAnchorElement(cat.HtmlUrl, cat.Name);
            }

            foreach (var post in this.PostList)
            {
                var el_para         = el_body.AddParagraphElement();
                var post_content_el = GetPostContentElement(post);
                el_body.Add(post_content_el);
            }

            string html = xdoc.ToString();

            foreach (var post in this.PostList)
            {
                string replacement_string = GetReplacementString(post);
                html = html.Replace(replacement_string, post.Description);
            }

            WriteResponseString(context, html, 200, ContentType_TextHtml);
        }
 private void handle_normal_request(System.Net.HttpListenerContext context)
 {
     this.WriteLogMethodName();
     if (context.Request.Url.AbsolutePath == "/")
     {
         handle_blog_home_page(context);
     }
     else if (context.Request.Url.AbsolutePath == this.Options.ArchiveUrl)
     {
         handle_blog_archive_page(context);
     }
     else if (context.Request.Url.AbsolutePath.StartsWith("/media/"))
     {
         handle_media(context);
     }
     else if (context.Request.Url.AbsolutePath == ("/debug"))
     {
         handle_debug(context);
     }
     else if (context.Request.Url.AbsolutePath.StartsWith("/category/"))
     {
         handle_category(context);
     }
     else if (context.Request.Url.AbsolutePath.StartsWith(this.Options.PostUrl + "/"))
     {
         handle_post(context);
     }
     else
     {
         handle_404_not_found(context);
     }
 }
示例#22
0
 internal HttpListenerResponse(System.Net.HttpListenerContext httpContext) : this()
 {
     if (Logging.On)
     {
         Logging.Associate(Logging.HttpListener, this, httpContext);
     }
     this.m_HttpContext = httpContext;
 }
示例#23
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        public SystemHttpContext([NotNull] System.Net.HttpListenerContext context, CancellationToken cancellationToken)
        {
            _context           = context;
            _cancellationToken = cancellationToken;

            _response = new SystemHttpResponse(this, context.Response);
            _request  = new SystemHttpRequest(context.Request);
        }
 internal HttpListenerResponse(HttpListenerContext context, System.Net.HttpListenerContext inner)
 {
     this.context = context;
     this.inner   = inner.Response;
     this.Body    = this.inner.OutputStream;
     this.headers = new ResponseHeaderWrapper(inner);
     this.cookies = new ResponseCookies(this.headers, pool.CreateStringBuilderPool());
 }
示例#25
0
 string _http_cmd_ping(System.Net.HttpListenerContext req)
 {//固定协议
     MyJson.JsonNode_Object map = new MyJson.JsonNode_Object();
     map["status"] = new MyJson.JsonNode_ValueNumber(0);
     map["ver"]    = new MyJson.JsonNode_ValueString("V0.01");
     map["sign"]   = new MyJson.JsonNode_ValueString("sha1");
     return(map.ToString());
 }
示例#26
0
        private void respond_post(System.Net.HttpListenerContext context, PostInfoRecord post)
        {
            this.WriteLogMethodName();
            var method_response = new MP.XmlRpc.MethodResponse();
            var struct_         = post.ToPostInfo().ToStruct();

            method_response.Parameters.Add(struct_);
            WriteResponseString(context, method_response.CreateDocument().ToString(), 200, ContentType_TextXml);
        }
示例#27
0
        protected override void ProcessRequest(System.Net.HttpListenerContext context)
        {
            throw new NotImplementedException();

            /*
             * byte[] buffer = new byte[BuffSize];
             * context.Request.InputStream.Read(buffer, 0, BuffSize);
             */
        }
示例#28
0
        void _HttpListener_ResponseEvent(System.Net.HttpListenerContext ctx)
        {
            Dictionary <string, string> retPosts = _PrintHttpListener.GetRequestData(ctx, HttpMethodType.POST);
            var result = DoPrint(retPosts);
            JavaScriptSerializer js = new JavaScriptSerializer();
            var resultJosn          = js.Serialize(result);

            ResponseWrite(ctx.Request.AcceptTypes[0], resultJosn, ctx.Response);
        }
示例#29
0
        public void ProcessRequest(System.Net.HttpListenerContext context, Smobiler.Core.Web.HttpHandlerData handlerdata)
        {
            string rawResponse = string.Format("<Html><Head></Head><Body>Hello Dynamic Time {0}</Body></Html>", DateTime.Now.ToString());

            byte[] dataResponse = System.Text.Encoding.UTF8.GetBytes(rawResponse);
            context.Response.ContentLength64 = dataResponse.Length;
            context.Response.StatusCode      = 200;
            context.Response.OutputStream.Write(dataResponse, 0, dataResponse.Length);
            context.Response.OutputStream.Close();
        }
示例#30
0
        public byte[] CreateReturnResult(System.Net.HttpListenerContext context, ReturnCode result)
        {
            string responseString = string.Format("code={0}&msg={1}&request={2}",
                                                  result.Code,
                                                  result.Message,
                                                  context.Request.Url.ToString()
                                                  );

            return(System.Text.Encoding.UTF8.GetBytes(responseString));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ListenerWorkerRequest"/> class.
 /// </summary>
 /// <param name="appVirtualDir">The app virtual directory.</param>
 /// <param name="context">The listener context.</param>
 public ListenerWorkerRequest(
     string appVirtualDir,
     System.Net.HttpListenerContext context)
     : base(context.Request.Url.AbsolutePath.Substring(appVirtualDir.Length), 
     context.Request.Url.Query, 
     new StreamWriter(context.Response.OutputStream))
 {
     this.context = context;
     this.clientCert = this.context.Request.GetClientCertificate();
 }
示例#32
0
        public static void WriteStringToContext(System.Net.HttpListenerContext context, string returnValue)
        {
            Encoding encoding = context.Response.ContentEncoding;

            if (encoding == null)
            {
                encoding = Encoding.GetEncoding("ISO-8859-1");
            }
            WriteBytesToContext(context, encoding.GetBytes(returnValue));
        }
 internal unsafe HttpListenerRequest(System.Net.HttpListenerContext httpContext, RequestContextBase memoryBlob)
 {
     if (Logging.On)
     {
         Logging.PrintInfo(Logging.HttpListener, this, ".ctor", "httpContext#" + ValidationHelper.HashString(httpContext) + " memoryBlob# " + ValidationHelper.HashString((IntPtr) memoryBlob.RequestBlob));
     }
     if (Logging.On)
     {
         Logging.Associate(Logging.HttpListener, this, httpContext);
     }
     this.m_HttpContext = httpContext;
     this.m_MemoryBlob = memoryBlob;
     this.m_BoundaryType = BoundaryType.None;
     this.m_RequestId = memoryBlob.RequestBlob.RequestId;
     this.m_ConnectionId = memoryBlob.RequestBlob.ConnectionId;
     this.m_SslStatus = (memoryBlob.RequestBlob.pSslInfo == null) ? SslStatus.Insecure : ((memoryBlob.RequestBlob.pSslInfo.SslClientCertNegotiated == 0) ? SslStatus.NoClientCert : SslStatus.ClientCert);
     if ((memoryBlob.RequestBlob.pRawUrl != null) && (memoryBlob.RequestBlob.RawUrlLength > 0))
     {
         this.m_RawUrl = Marshal.PtrToStringAnsi((IntPtr) memoryBlob.RequestBlob.pRawUrl, memoryBlob.RequestBlob.RawUrlLength);
     }
     UnsafeNclNativeMethods.HttpApi.HTTP_COOKED_URL cookedUrl = memoryBlob.RequestBlob.CookedUrl;
     if ((cookedUrl.pHost != null) && (cookedUrl.HostLength > 0))
     {
         this.m_CookedUrlHost = Marshal.PtrToStringUni((IntPtr) cookedUrl.pHost, cookedUrl.HostLength / 2);
     }
     if ((cookedUrl.pAbsPath != null) && (cookedUrl.AbsPathLength > 0))
     {
         this.m_CookedUrlPath = Marshal.PtrToStringUni((IntPtr) cookedUrl.pAbsPath, cookedUrl.AbsPathLength / 2);
     }
     if ((cookedUrl.pQueryString != null) && (cookedUrl.QueryStringLength > 0))
     {
         this.m_CookedUrlQuery = Marshal.PtrToStringUni((IntPtr) cookedUrl.pQueryString, cookedUrl.QueryStringLength / 2);
     }
     this.m_Version = new Version(memoryBlob.RequestBlob.Version.MajorVersion, memoryBlob.RequestBlob.Version.MinorVersion);
     this.m_ClientCertState = ListenerClientCertState.NotInitialized;
     this.m_KeepAlive = TriState.Unspecified;
     if (Logging.On)
     {
         Logging.PrintInfo(Logging.HttpListener, this, ".ctor", "httpContext#" + ValidationHelper.HashString(httpContext) + " RequestUri:" + ValidationHelper.ToString(this.RequestUri) + " Content-Length:" + ValidationHelper.ToString(this.ContentLength64) + " HTTP Method:" + ValidationHelper.ToString(this.HttpMethod));
     }
     if (Logging.On)
     {
         StringBuilder builder = new StringBuilder("HttpListenerRequest Headers:\n");
         for (int i = 0; i < this.Headers.Count; i++)
         {
             builder.Append("\t");
             builder.Append(this.Headers.GetKey(i));
             builder.Append(" : ");
             builder.Append(this.Headers.Get(i));
             builder.Append("\n");
         }
         Logging.PrintInfo(Logging.HttpListener, this, ".ctor", builder.ToString());
     }
 }