bool TryReceiveRequestCore(TimeSpan timeout, out RequestContext context) { context = null; if (waiting.Count == 0 && !WaitForRequest(timeout)) { return(false); } lock (waiting) { if (waiting.Count > 0) { http_context = waiting [0]; waiting.RemoveAt(0); } } if (http_context == null) { // Though as long as this instance is used // synchronously, it should not happen. return(false); } if (http_context.Response.StatusCode != 200) { http_context.Response.Close(); return(false); } Message msg; var req = http_context.Request; if (req.HttpMethod == "GET") { msg = Message.CreateMessage(Encoder.MessageVersion, null); } else { //FIXME: Do above stuff for HttpContext ? int maxSizeOfHeaders = 0x10000; msg = Encoder.ReadMessage( req.InputStream, maxSizeOfHeaders); if (Encoder.MessageVersion.Envelope == EnvelopeVersion.Soap11) { string action = GetHeaderItem(req.Headers ["SOAPAction"]); if (action != null) { msg.Headers.Action = action; } } } // FIXME: prop.SuppressEntityBody msg.Headers.To = req.Url; msg.Properties.Add("Via", LocalAddress.Uri); msg.Properties.Add(HttpRequestMessageProperty.Name, CreateRequestProperty(req.HttpMethod, req.Url.Query, req.Headers)); context = new AspNetRequestContext(this, msg, http_context); return(true); }
bool TryReceiveRequestCore (TimeSpan timeout, out RequestContext context) { context = null; if (waiting.Count == 0 && !WaitForRequest (timeout)) return false; lock (waiting) { if (waiting.Count > 0) { http_context = waiting [0]; waiting.RemoveAt (0); } } if (http_context == null) // Though as long as this instance is used // synchronously, it should not happen. return false; if (http_context.Response.StatusCode != 200) { http_context.Response.Close (); return false; } Message msg; var req = http_context.Request; if (req.HttpMethod == "GET") { msg = Message.CreateMessage (Encoder.MessageVersion, null); } else { //FIXME: Do above stuff for HttpContext ? int maxSizeOfHeaders = 0x10000; msg = Encoder.ReadMessage ( req.InputStream, maxSizeOfHeaders); if (Encoder.MessageVersion.Envelope == EnvelopeVersion.Soap11) { string action = GetHeaderItem (req.Headers ["SOAPAction"]); if (action != null) msg.Headers.Action = action; } } // FIXME: prop.SuppressEntityBody msg.Headers.To = req.Url; msg.Properties.Add ("Via", LocalAddress.Uri); msg.Properties.Add (HttpRequestMessageProperty.Name, CreateRequestProperty (req.HttpMethod, req.Url.Query, req.Headers)); context = new AspNetRequestContext (this, msg, http_context); return true; }