예제 #1
0
        protected override byte[] ProcessRequest(
            string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
        {
            string[] p = SplitParams(path);

            if (p.Length == 0)
            {
                return(new byte[0]);
            }

            using (StreamReader sr = new StreamReader(request))
                m_BakesService.Store(p[0], sr.ReadToEnd());

            return(new byte[0]);
        }
예제 #2
0
        private void doPost(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
        {
            string[] p = SplitParams(httpRequest.UriPath);

            if (p.Length == 0)
            {
                return;
            }
            // httpRequest.InputStream is a memorystream with origin = 0
            // so no need to copy to another array
            MemoryStream ms  = (MemoryStream)httpRequest.InputStream;
            int          len = (int)ms.Length;

            byte[] data = ms.GetBuffer();
            httpRequest.InputStream.Dispose(); // the buffer stays in data
            m_BakesService.Store(p[0], data, len);
        }
예제 #3
0
        public override byte[] Handle(string path, Stream request,
                                      IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
        {
            string[] p = SplitParams(path);

            if (p.Length == 0)
            {
                return(new byte[0]);
            }

            StreamReader sr = new StreamReader(request);

            m_BakesService.Store(p[0], sr.ReadToEnd());
            sr.Close();

            return(new byte[0]);
        }