提交 1180f646 编写于 作者: M Marcos Henrich

[System.Web] HeadersCollection read only exception

In reference source HttpHeaderCollection [1] when Add, Set or Remove is
called and the collection is readonly a PlatformNotSupportedException is
thrown.

Mono HeadersCollection was throwing NotSupportedException and
Microsoft.Owin.Host.SystemWeb.OwinCallContext.RemoveAcceptEncoding was
not catching the exception because it was expecting
PlatformNotSupportedException.

Fixes #33809

[1] http://referencesource.microsoft.com/#System.Web/HttpHeaderCollection.cs,73
上级 861ab4c9
......@@ -39,6 +39,30 @@ namespace System.Web
{
}
public override void Add (string name, string value)
{
if (IsReadOnly)
throw new PlatformNotSupportedException ();
base.Set (name, value);
}
public override void Set (string name, string value)
{
if (IsReadOnly)
throw new PlatformNotSupportedException ();
base.Set (name, value);
}
public override void Remove (string name)
{
if (IsReadOnly)
throw new PlatformNotSupportedException ();
base.Remove (name);
}
protected override void InsertInfo()
{
HttpWorkerRequest worker_request = _request.WorkerRequest;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册