Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/aspnetwebstack.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhenrikn@microsoft.com <henrikn@microsoft.com>2012-10-20 20:18:27 +0400
committerhenrikn@microsoft.com <henrikn@microsoft.com>2012-10-23 20:43:50 +0400
commita88383fe6ee1ee884d7aafe705e8c4dfab57a70f (patch)
tree2c39f9df5b88e38b3f861db3960def033fa3460c /src
parent464129724322d7c343ed424eefe9d9572d675d49 (diff)
Fixes an issue where HttpContent.ReadAsHttpRequestMessageAsync and HttpContent.ReadAsHttpResponseMessageAsync do not detect the end of stream for incomplete HTTP messages.
The fix involves checking for if the stream has been completely read and if HTTP message is not complete then throw an exception saying the the content is an incomplete HTTP request or response.
Diffstat (limited to 'src')
-rw-r--r--src/System.Net.Http.Formatting/HttpContentMessageExtensions.cs8
-rw-r--r--src/System.Net.Http.Formatting/Properties/Resources.Designer.cs15
-rw-r--r--src/System.Net.Http.Formatting/Properties/Resources.resx3
3 files changed, 23 insertions, 3 deletions
diff --git a/src/System.Net.Http.Formatting/HttpContentMessageExtensions.cs b/src/System.Net.Http.Formatting/HttpContentMessageExtensions.cs
index ed38e0b2..531b6134 100644
--- a/src/System.Net.Http.Formatting/HttpContentMessageExtensions.cs
+++ b/src/System.Net.Http.Formatting/HttpContentMessageExtensions.cs
@@ -187,6 +187,10 @@ namespace System.Net.Http
{
throw Error.InvalidOperation(Properties.Resources.HttpMessageParserError, headerConsumed, buffer);
}
+ else if (bytesRead == 0)
+ {
+ throw new IOException(Properties.Resources.ReadAsHttpMessageUnexpectedTermination);
+ }
}
});
}
@@ -278,6 +282,10 @@ namespace System.Net.Http
{
throw Error.InvalidOperation(Properties.Resources.HttpMessageParserError, headerConsumed, buffer);
}
+ else if (bytesRead == 0)
+ {
+ throw new IOException(Properties.Resources.ReadAsHttpMessageUnexpectedTermination);
+ }
}
});
}
diff --git a/src/System.Net.Http.Formatting/Properties/Resources.Designer.cs b/src/System.Net.Http.Formatting/Properties/Resources.Designer.cs
index 0e58112a..2359ad5c 100644
--- a/src/System.Net.Http.Formatting/Properties/Resources.Designer.cs
+++ b/src/System.Net.Http.Formatting/Properties/Resources.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:4.0.30319.269
+// Runtime Version:4.0.30319.18010
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -10,8 +10,8 @@
namespace System.Net.Http.Properties {
using System;
- using System.Reflection;
-
+ using System.Reflection;
+
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
@@ -444,6 +444,15 @@ namespace System.Net.Http.Properties {
}
/// <summary>
+ /// Looks up a localized string similar to Unexpected end of HTTP message stream. HTTP message is not complete..
+ /// </summary>
+ internal static string ReadAsHttpMessageUnexpectedTermination {
+ get {
+ return ResourceManager.GetString("ReadAsHttpMessageUnexpectedTermination", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Invalid &apos;{0}&apos; instance provided. It does not have a &apos;{1}&apos; content-type header with a &apos;{2}&apos; parameter..
/// </summary>
internal static string ReadAsMimeMultipartArgumentNoBoundary {
diff --git a/src/System.Net.Http.Formatting/Properties/Resources.resx b/src/System.Net.Http.Formatting/Properties/Resources.resx
index aa5bb91c..e83efdf2 100644
--- a/src/System.Net.Http.Formatting/Properties/Resources.resx
+++ b/src/System.Net.Http.Formatting/Properties/Resources.resx
@@ -288,4 +288,7 @@
<data name="DelegatingHandlerArrayHasNonNullInnerHandler" xml:space="preserve">
<value>The '{0}' list is invalid because the property '{1}' of '{2}' is not null.</value>
</data>
+ <data name="ReadAsHttpMessageUnexpectedTermination" xml:space="preserve">
+ <value>Unexpected end of HTTP message stream. HTTP message is not complete.</value>
+ </data>
</root> \ No newline at end of file