[Mono-list] XSP Binary File Upload Patch

Brian Ritchie brianlritchie@hotmail.com
Sun, 02 Feb 2003 14:47:10 -0500


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.


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);
	return bytes.Length;

MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.