#56 - Make Request & Response Stream throw IOException.

This commit is contained in:
Chris Ross 2014-09-12 15:38:02 -07:00
Родитель 736fc684e6
Коммит 0139bea6d2
4 изменённых файлов: 14 добавлений и 13 удалений

Просмотреть файл

@ -178,7 +178,7 @@ namespace Microsoft.Net.Http.Server
}
if (statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_HANDLE_EOF)
{
Exception exception = new WebListenerException((int)statusCode);
Exception exception = new IOException(string.Empty, new WebListenerException((int)statusCode));
LogHelper.LogException(_requestContext.Logger, "Read", exception);
Abort();
throw exception;
@ -275,7 +275,7 @@ namespace Microsoft.Net.Http.Server
}
else
{
Exception exception = new WebListenerException((int)statusCode);
Exception exception = new IOException(string.Empty, new WebListenerException((int)statusCode));
LogHelper.LogException(_requestContext.Logger, "BeginRead", exception);
Abort();
throw exception;
@ -401,7 +401,7 @@ namespace Microsoft.Net.Http.Server
}
else
{
Exception exception = new WebListenerException((int)statusCode);
Exception exception = new IOException(string.Empty, new WebListenerException((int)statusCode));
LogHelper.LogException(_requestContext.Logger, "ReadAsync", exception);
Abort();
throw exception;

Просмотреть файл

@ -23,6 +23,7 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
@ -109,7 +110,7 @@ namespace Microsoft.Net.Http.Server
{
if (errorCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && errorCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_HANDLE_EOF)
{
asyncResult.Fail(new WebListenerException((int)errorCode));
asyncResult.Fail(new IOException(string.Empty, new WebListenerException((int)errorCode)));
}
else
{

Просмотреть файл

@ -113,7 +113,7 @@ namespace Microsoft.Net.Http.Server
if (statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_HANDLE_EOF)
{
throw new WebListenerException((int)statusCode);
throw new IOException(string.Empty, new WebListenerException((int)statusCode));
}
}
catch (Exception e)
@ -164,7 +164,7 @@ namespace Microsoft.Net.Http.Server
}
else if (statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_IO_PENDING)
{
throw new WebListenerException((int)statusCode);
throw new IOException(string.Empty, new WebListenerException((int)statusCode));
}
}
catch (Exception e)
@ -351,7 +351,7 @@ namespace Microsoft.Net.Http.Server
if (statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_HANDLE_EOF)
{
Exception exception = new WebListenerException((int)statusCode);
Exception exception = new IOException(string.Empty, new WebListenerException((int)statusCode));
LogHelper.LogException(_requestContext.Logger, "Write", exception);
Abort();
throw exception;
@ -444,7 +444,7 @@ namespace Microsoft.Net.Http.Server
}
else
{
Exception exception = new WebListenerException((int)statusCode);
Exception exception = new IOException(string.Empty, new WebListenerException((int)statusCode));
LogHelper.LogException(_requestContext.Logger, "BeginWrite", exception);
Abort();
throw exception;
@ -589,7 +589,7 @@ namespace Microsoft.Net.Http.Server
}
else
{
Exception exception = new WebListenerException((int)statusCode);
Exception exception = new IOException(string.Empty, new WebListenerException((int)statusCode));
LogHelper.LogException(_requestContext.Logger, "WriteAsync", exception);
Abort();
throw exception;
@ -602,7 +602,7 @@ namespace Microsoft.Net.Http.Server
asyncResult.IOCompleted(statusCode, bytesSent);
}
// Last write, cache it for special cancelation handling.
// Last write, cache it for special cancellation handling.
if ((flags & UnsafeNclNativeMethods.HttpApi.HTTP_FLAGS.HTTP_SEND_RESPONSE_FLAG_MORE_DATA) == 0)
{
_lastWrite = asyncResult;
@ -710,7 +710,7 @@ namespace Microsoft.Net.Http.Server
}
else
{
Exception exception = new WebListenerException((int)statusCode);
Exception exception = new IOException(string.Empty, new WebListenerException((int)statusCode));
LogHelper.LogException(_requestContext.Logger, "SendFileAsync", exception);
Abort();
throw exception;
@ -829,7 +829,7 @@ namespace Microsoft.Net.Http.Server
// Don't throw for disconnects, we were already finished with the response.
&& statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_CONNECTION_INVALID)
{
Exception exception = new WebListenerException((int)statusCode);
Exception exception = new IOException(string.Empty, new WebListenerException((int)statusCode));
LogHelper.LogException(_requestContext.Logger, "Dispose", exception);
_requestContext.Abort();
throw exception;

Просмотреть файл

@ -291,7 +291,7 @@ namespace Microsoft.Net.Http.Server
{
if (errorCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && errorCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_HANDLE_EOF)
{
asyncResult.Fail(new WebListenerException((int)errorCode));
asyncResult.Fail(new IOException(string.Empty, new WebListenerException((int)errorCode)));
}
else
{