internal HttpListenerResponse(HttpListenerContext httpContext) : this() { if (Logging.On) { Logging.Associate(Logging.HttpListener, this, httpContext); } m_HttpContext = httpContext; }
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()); } }