Bend.Util.HttpServer.handlePOSTRequest C# (CSharp) Метод

handlePOSTRequest() публичный абстрактный Метод

public abstract handlePOSTRequest ( HttpProcessor p, StreamReader inputData ) : void
p HttpProcessor
inputData System.IO.StreamReader
Результат void
        public abstract void handlePOSTRequest(HttpProcessor p, StreamReader inputData);

Usage Example

        public void handlePOSTRequest()
        {
            // this post data processing just reads everything into a memory stream.
            // this is fine for smallish things, but for large stuff we should really
            // hand an input stream to the request processor. However, the input stream
            // we hand him needs to let him see the "end of the stream" at this content
            // length, because otherwise he won't know when he's seen it all!

            //Console.WriteLine("get post data start");
            int          content_len = 0;
            MemoryStream ms          = new MemoryStream();

            if (this.httpHeaders.ContainsKey("Content-Length"))
            {
                content_len = Convert.ToInt32(this.httpHeaders["Content-Length"]);
                if (content_len > MAX_POST_SIZE)
                {
                    throw new Exception(
                              String.Format("POST Content-Length({0}) too big for this simple server",
                                            content_len));
                }
                byte[] buf     = new byte[4096];
                int    to_read = content_len;
                while (to_read > 0)
                {
                    int numread = this.inputStream.BaseStream.Read(buf, 0, Math.Min(4096, to_read));
                    to_read -= numread;
                    ms.Write(buf, 0, numread);
                }
                ms.Seek(0, SeekOrigin.Begin);
            }
            //Console.WriteLine("get post data end");
            srv.handlePOSTRequest(this, new StreamReader(ms));
        }
All Usage Examples Of Bend.Util.HttpServer::handlePOSTRequest