Skip to content
This repository has been archived by the owner on Nov 19, 2022. It is now read-only.

Commit

Permalink
2005-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
Browse files Browse the repository at this point in the history
	* XSPWorkerRequest.cs: if we get a 0, don't pretend we read up to 'size'.
	* XSPApplicationHost.cs: returning 0 in Read is fine.


svn path=/trunk/xsp/; revision=48870
  • Loading branch information
gonzalop committed Aug 26, 2005
1 parent 6ce3604 commit 1c2be38
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -1,3 +1,9 @@
2005-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>

* src/Mono.WebServer/XSPWorkerRequest.cs: if we get a 0, don't pretend
we read up to 'size'.
* src/Mono.WebServer/XSPApplicationHost.cs: returning 0 in Read is fine.

2005-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>

* src/Mono.WebServer/XSPWorkerRequest.cs: if we get a -1 when reading
Expand Down
2 changes: 1 addition & 1 deletion src/Mono.WebServer/XSPApplicationHost.cs
Expand Up @@ -304,7 +304,7 @@ public void Run (object state)
public int Read (byte[] buffer, int position, int size)
{
int n = stream.Read (buffer, position, size);
return (n > 0) ? n : -1;
return (n >= 0) ? n : -1;
}

public void Write (byte[] buffer, int position, int size)
Expand Down
11 changes: 6 additions & 5 deletions src/Mono.WebServer/XSPWorkerRequest.cs
Expand Up @@ -594,21 +594,22 @@ int ReadInput (byte [] buffer, int offset, int size)
return length;
}

int localsize = size;
while (localsize > 0) {
int localsize = 0;
while (size > 0) {
byte[] readBuffer;
int read = requestBroker.Read (requestId, localsize, out readBuffer);
int read = requestBroker.Read (requestId, size, out readBuffer);
if (read == 0)
break;

if (read < 0)
throw new HttpException (500, "Error reading request.");
Buffer.BlockCopy (readBuffer, 0, buffer, offset, read);
offset += read;
localsize -= read;
size -= read;
localsize += read;
}

return (length + size);
return (length + localsize);
}

public override int ReadEntityBody (byte [] buffer, int size)
Expand Down

0 comments on commit 1c2be38

Please sign in to comment.