diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestStream.cs b/src/Microsoft.Net.Http.Server/RequestProcessing/RequestStream.cs index de77301209..0beaf04cda 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestStream.cs +++ b/src/Microsoft.Net.Http.Server/RequestProcessing/RequestStream.cs @@ -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; diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestStreamAsyncResult.cs b/src/Microsoft.Net.Http.Server/RequestProcessing/RequestStreamAsyncResult.cs index d0218466cb..6976d21725 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestStreamAsyncResult.cs +++ b/src/Microsoft.Net.Http.Server/RequestProcessing/RequestStreamAsyncResult.cs @@ -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 { diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/ResponseStream.cs b/src/Microsoft.Net.Http.Server/RequestProcessing/ResponseStream.cs index 4be40d6c69..6b428a29d5 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/ResponseStream.cs +++ b/src/Microsoft.Net.Http.Server/RequestProcessing/ResponseStream.cs @@ -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; diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/ResponseStreamAsyncResult.cs b/src/Microsoft.Net.Http.Server/RequestProcessing/ResponseStreamAsyncResult.cs index 18b4952793..d1dfc1bb9e 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/ResponseStreamAsyncResult.cs +++ b/src/Microsoft.Net.Http.Server/RequestProcessing/ResponseStreamAsyncResult.cs @@ -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 {