static private SetupUrlBashingForIisSslIfNecessary ( ) : bool | ||
return | bool |
} // AsyncProcessResponse private void SerializeResponse(IServerResponseChannelSinkStack sinkStack, IMessage msg, bool bClientIsClr, ref ITransportHeaders headers, out Stream stream) { BaseTransportHeaders responseHeaders = new BaseTransportHeaders(); if (headers != null) { // copy old headers into new headers foreach (DictionaryEntry entry in headers) { responseHeaders[entry.Key] = entry.Value; } } headers = responseHeaders; responseHeaders.ContentType = CoreChannel.SOAPContentType; if (_protocol == Protocol.Http) { // check to see if an exception occurred (requires special status code for HTTP) IMethodReturnMessage mrm = msg as IMethodReturnMessage; if ((mrm != null) && (mrm.Exception != null)) { headers["__HttpStatusCode"] = "500"; headers["__HttpReasonPhrase"] = "Internal Server Error"; } } bool bMemStream = false; stream = sinkStack.GetResponseStream(msg, headers); if (stream == null) { stream = new ChunkedMemoryStream(CoreChannel.BufferPool); bMemStream = true; } bool bBashUrl = CoreChannel.SetupUrlBashingForIisSslIfNecessary(); CallContext.SetData("__ClientIsClr", bClientIsClr); try { CoreChannel.SerializeSoapMessage(msg, stream, _includeVersioning); } finally { CallContext.FreeNamedDataSlot("__ClientIsClr"); CoreChannel.CleanupUrlBashingForIisSslIfNecessary(bBashUrl); } if (bMemStream) { stream.Position = 0; } } // SerializeResponse
} // AsyncProcessResponse private void SerializeResponse(IServerResponseChannelSinkStack sinkStack, IMessage msg, ref ITransportHeaders headers, out Stream stream) { BaseTransportHeaders responseHeaders = new BaseTransportHeaders(); if (headers != null) { // copy old headers into new headers foreach (DictionaryEntry entry in headers) { responseHeaders[entry.Key] = entry.Value; } } headers = responseHeaders; if (_protocol == Protocol.Http) { responseHeaders.ContentType = CoreChannel.BinaryMimeType; } bool bMemStream = false; stream = sinkStack.GetResponseStream(msg, headers); if (stream == null) { stream = new ChunkedMemoryStream(CoreChannel.BufferPool); bMemStream = true; } bool bBashUrl = CoreChannel.SetupUrlBashingForIisSslIfNecessary(); try { CallContext.SetData("__ClientIsClr", true); CoreChannel.SerializeBinaryMessage(msg, stream, _includeVersioning); } finally { CallContext.FreeNamedDataSlot("__ClientIsClr"); CoreChannel.CleanupUrlBashingForIisSslIfNecessary(bBashUrl); } if (bMemStream) { stream.Position = 0; } } // SerializeResponse
private void SerializeResponse(IServerResponseChannelSinkStack sinkStack, IMessage msg, bool bClientIsClr, ref ITransportHeaders headers, out Stream stream) { BaseTransportHeaders headers2 = new BaseTransportHeaders(); if (headers != null) { foreach (DictionaryEntry entry in headers) { headers2[entry.Key] = entry.Value; } } headers = headers2; headers2.ContentType = "text/xml; charset=\"utf-8\""; if (this._protocol == Protocol.Http) { IMethodReturnMessage message = msg as IMethodReturnMessage; if ((message != null) && (message.Exception != null)) { headers["__HttpStatusCode"] = "500"; headers["__HttpReasonPhrase"] = "Internal Server Error"; } } bool flag = false; stream = sinkStack.GetResponseStream(msg, headers); if (stream == null) { stream = new ChunkedMemoryStream(CoreChannel.BufferPool); flag = true; } bool bBashedUrl = CoreChannel.SetupUrlBashingForIisSslIfNecessary(); CallContext.SetData("__ClientIsClr", bClientIsClr); try { CoreChannel.SerializeSoapMessage(msg, stream, this._includeVersioning); } finally { CallContext.FreeNamedDataSlot("__ClientIsClr"); CoreChannel.CleanupUrlBashingForIisSslIfNecessary(bBashedUrl); } if (flag) { stream.Position = 0L; } }
private void SerializeResponse(IServerResponseChannelSinkStack sinkStack, IMessage msg, ref ITransportHeaders headers, out Stream stream) { BaseTransportHeaders headers2 = new BaseTransportHeaders(); if (headers != null) { foreach (DictionaryEntry entry in headers) { headers2[entry.Key] = entry.Value; } } headers = headers2; if (this._protocol == Protocol.Http) { headers2.ContentType = "application/octet-stream"; } bool flag = false; stream = sinkStack.GetResponseStream(msg, headers); if (stream == null) { stream = new ChunkedMemoryStream(CoreChannel.BufferPool); flag = true; } bool bBashedUrl = CoreChannel.SetupUrlBashingForIisSslIfNecessary(); try { CallContext.SetData("__ClientIsClr", true); CoreChannel.SerializeBinaryMessage(msg, stream, this._includeVersioning); } finally { CallContext.FreeNamedDataSlot("__ClientIsClr"); CoreChannel.CleanupUrlBashingForIisSslIfNecessary(bBashedUrl); } if (flag) { stream.Position = 0L; } }