Exemplo n.º 1
0
 public void Write(PipeStream stream)
 {
     foreach (string key in mItems.Keys)
     {
         HeaderType.Write(key, stream);
         stream.Write(mItems[key]);
         stream.Write(HeaderType.LINE_BYTES, 0, 2);
     }
 }
Exemplo n.º 2
0
 internal void Write(PipeStream stream)
 {
     foreach (var item in mItems)
     {
         HeaderType.Write(item.Key, stream);
         stream.Write(item.Value);
         stream.Write(HeaderType.LINE_BYTES, 0, 2);
     }
 }
Exemplo n.º 3
0
        internal void Write(PipeStream stream)
        {
            stream.Write(HttpVersion);
            stream.Write(HeaderType.SPACE_BYTES[0]);
            stream.Write(mCode);
            stream.Write(HeaderType.SPACE_BYTES[0]);
            stream.Write(CodeMsg);
            stream.Write(HeaderType.LINE_BYTES);
            Header.Write(stream);
            for (int i = 0; i < mSetCookies.Count; i++)
            {
                HeaderType.Write(HeaderType.SET_COOKIE, stream);
                stream.Write(mSetCookies[i]);
                stream.Write(HeaderType.LINE_BYTES);
            }
            if (mBody != null)
            {
                StaticResurce.FileBlock fb = mBody as StaticResurce.FileBlock;
                if (fb != null)
                {
                    stream.Write(HeaderType.LINE_BYTES);
                    fb.Write(stream);
                }
                else
                {
                    MemoryBlockCollection contentLength = stream.Allocate(28);
                    stream.Write(HeaderType.LINE_BYTES);
                    int count = Serializer.Serialize(stream, mBody);
                    contentLength.Full("Content-Length: " + count.ToString().PadRight(10) + "\r\n", stream.Encoding);
                }
            }
            else
            {
                stream.Write(HeaderType.NULL_CONTENT_LENGTH_BYTES);
                stream.Write(HeaderType.LINE_BYTES);
            }

            if (Session.Server.EnableLog(EventArgs.LogType.Debug))
            {
                Session.Server.Log(EventArgs.LogType.Debug, Session, "{0} {1}", Request.ClientIPAddress, this.ToString());
            }

            if (Session.Server.EnableLog(EventArgs.LogType.Info))
            {
                Session.Server.Log(EventArgs.LogType.Info, Session, "{4} {0} {1} response {2} {3}", Request.Method, Request.Url, Code, CodeMsg, Request.ClientIPAddress);
            }
        }
Exemplo n.º 4
0
 internal void Write(PipeStream stream)
 {
     stream.Write(HttpVersion);
     stream.Write(HeaderType.SPACE_BYTES[0]);
     stream.Write(mCode);
     stream.Write(HeaderType.SPACE_BYTES[0]);
     stream.Write(CodeMsg);
     stream.Write(HeaderType.LINE_BYTES);
     Header.Write(stream);
     for (int i = 0; i < mSetCookies.Count; i++)
     {
         HeaderType.Write(HeaderType.SET_COOKIE, stream);
         stream.Write(mSetCookies[i]);
         stream.Write(HeaderType.LINE_BYTES);
     }
     if (mBody != null)
     {
         StaticResurce.FileBlock fb = mBody as StaticResurce.FileBlock;
         if (fb != null)
         {
             stream.Write(HeaderType.LINE_BYTES);
             fb.Write(stream);
         }
         else
         {
             MemoryBlockCollection contentLength = stream.Allocate(28);
             stream.Write(HeaderType.LINE_BYTES);
             int count = Serializer.Serialize(stream, mBody);
             contentLength.Full("Content-Length: " + count.ToString().PadRight(10) + "\r\n", stream.Encoding);
         }
     }
     else
     {
         stream.Write(HeaderType.NULL_CONTENT_LENGTH_BYTES);
         stream.Write(HeaderType.LINE_BYTES);
     }
 }