Example #1
0
        private void OnMultiPartFormData(string boundary, byte [] data)
        {
            IMFDStream stream = new InMemoryMFDStream (data);
            MultipartFormDataParser parser = new MultipartFormDataParser (this.Request, boundary, stream, () => {
                IOStream.DisableReading ();
                Server.RunTransaction (this);
            });

            parser.ParseParts ();
        }
Example #2
0
        private void HandleLargeBody()
        {
            if (Request.Method != "POST" && Request.Method != "PUT")
                throw new InvalidOperationException ("Large Request bodies are only allowed with PUT or POST operations.");

            string ct = Request.Headers ["Content-Type"];
            if (ct == null || !ct.StartsWith ("multipart/form-data", StringComparison.InvariantCultureIgnoreCase)) {
                // TODO: Maybe someone wants to post large www-form-urlencoded data?
                throw new InvalidOperationException ("Large Request bodies are only allowed with multipart form data.");
            }

            string boundary = ParseBoundary (ct);
            IMFDStream stream = new TempFileMFDStream (IOStream);

            MultipartFormDataParser parser = new MultipartFormDataParser (this.Request, boundary, stream, () => {
                IOStream.DisableReading ();
                Server.RunTransaction (this);
            });

            parser.ParseParts ();
        }