[Mono-list] XSP Binary File Upload Patch
Gonzalo Paniagua Javier
gonzalo@ximian.com
02 Feb 2003 23:29:43 +0100
El dom, 02-02-2003 a las 20:47, Brian Ritchie escribió:
> Gonzalo/Simon,
>
> I've been working with an application using the XSP Server. It needs to
> support uploading of binary files. XSP seems to support uploading of text
> files, but not binary. After much research, I found a bug in the
> ReadEntityBody method. It was using a TextReader to read the body of the
> post. Here's a patch that allows XSP to handle binary uploads. Please
> review and apply.
>
> Thanks,
> Brian
>
>
> Replace this method in XSPWorkerRequest.cs:
>
> public override int ReadEntityBody (byte [] buffer, int size)
> {
> WebTrace.WriteLine ("ReadEntityBody()");
> if (buffer == null || size == 0)
> return 0;
>
> BinaryReader reader=new BinaryReader(output);
> byte [] bytes = reader.ReadBytes(size);
> bytes.CopyTo(buffer,0);
> return bytes.Length;
> }
Thanks. I will include your code and do some changes to avoid using a
StreamReader on the input which may read some data and keep it buffered
making ReadEntityBody lose the buffered data.
-Gonzalo