Skip to content
Permalink
Browse files

[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
  • Loading branch information...
esdrubal committed Jan 28, 2016
1 parent 6723b79 commit 98f0a7b39a8e7b74620bff1de2bf14ed42936810
Showing with 24 additions and 0 deletions.
  1. +24 −0 mcs/class/System.Web/System.Web/HeadersCollection.cs
@@ -39,6 +39,30 @@ public HeadersCollection(HttpRequest request):base(request)
{
}

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;

0 comments on commit 98f0a7b

Please sign in to comment.
You can’t perform that action at this time.