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]); }
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); }
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]); }