コード例 #1
0
        /// <summary>
        /// This method should (and is) automatically called whenever any part of the body is to be sent. It sends the response's status code
        /// and the response headers.
        /// </summary>
        private void SendHeaders()
        {
            // This foreach loop implements the server.OnSendingHeaders common Owin key
            // See http://owin.org/spec/spec/CommonKeys.html#_6._Common_keys
            // This is needed for any of the MS authentication middleware to work
            foreach (var callbackTuple in onSendHeadersCallbacks)
            {
                callbackTuple.Item1(callbackTuple.Item2);
            }

            var headers = (IDictionary <string, string[]>)OwinContext["owin.ResponseHeaders"];

            using (var headerStream = new Fos.Streams.NonEndingStdoutSocketStream(Socket))
            {
                headerStream.RequestId = RequestId;

                using (var writer = new Fos.Streams.HeaderWriter(headerStream))
                {
                    // Response status code with special CGI header "Status"
                    writer.Write("Status", OwinContext.ResponseStatusCodeAndReason);

                    foreach (var header in headers)
                    {
                        writer.Write(header.Key, header.Value);
                    }

                    // That last newline
                    writer.WriteLine();
                }
            }
        }
コード例 #2
0
ファイル: FosRequest.cs プロジェクト: james-andrewsmith/Fos
		/// <summary>
		/// This method should (and is) automatically called whenever any part of the body is to be sent. It sends the response's status code
		/// and the response headers.
		/// </summary>
		private void SendHeaders()
 		{
            this.OwinContext.FireOnSendingHeaders();
			var headers = (IDictionary<string, string[]>)OwinContext["owin.ResponseHeaders"];
            
			
			using (var headerStream = new Fos.Streams.NonEndingStdoutSocketStream(Socket))
            {
                headerStream.RequestId = RequestId;

                using (var writer = new Fos.Streams.HeaderWriter(headerStream))
                {
                    // Response status code with special CGI header "Status"
                    writer.Write("Status", OwinContext.ResponseStatusCodeAndReason);

                    foreach (var header in headers)
                    {
                        writer.Write(header.Key, header.Value);
                    }

                    // That last newline
                    writer.WriteLine();
                }
            }
		}
コード例 #3
0
        /// <summary>
        /// This method should (and is) automatically called whenever any part of the body is to be sent. It sends the response's status code
        /// and the response headers.
        /// </summary>
        private void SendHeaders()
        {
            var headers = (IDictionary <string, string[]>)OwinContext["owin.ResponseHeaders"];

            using (var headerStream = new Fos.Streams.NonEndingStdoutSocketStream(Socket))
            {
                headerStream.RequestId = RequestId;

                using (var writer = new Fos.Streams.HeaderWriter(headerStream))
                {
                    // Response status code with special CGI header "Status"
                    writer.Write("Status", OwinContext.ResponseStatusCodeAndReason);

                    foreach (var header in headers)
                    {
                        writer.Write(header.Key, header.Value);
                    }

                    // That last newline
                    writer.WriteLine();
                }
            }
        }