[#6515][WCF]: Enable custom headers for NET_2_1.
authorMartin Baulig <martin.baulig@xamarin.com>
Mon, 17 Sep 2012 15:27:36 +0000 (17:27 +0200)
committerMartin Baulig <martin.baulig@xamarin.com>
Mon, 17 Sep 2012 15:31:44 +0000 (17:31 +0200)
This allows

HttpRequestMessageProperty request = new HttpRequestMessageProperty ();
request.Headers.Add ("Foo", "Bar");

OperationContext.Current.OutgoingMessageProperties.Add (HttpRequestMessageProperty.Name, request);

The code was already there, but disabled for the NET_2_1 profile.

mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs

index 606201a33683c66623844884334622ad4c646ac9..b7218b003fc4fee25156fcf251dcbd76418ccf9d 100644 (file)
@@ -153,11 +153,9 @@ namespace System.ServiceModel.Channels
                        string pname = HttpRequestMessageProperty.Name;
                        if (message.Properties.ContainsKey (pname)) {
                                HttpRequestMessageProperty hp = (HttpRequestMessageProperty) message.Properties [pname];
-#if !NET_2_1 // FIXME: how can this be done?
                                foreach (var key in hp.Headers.AllKeys)
                                        if (!WebHeaderCollection.IsRestricted (key))
                                                web_request.Headers [key] = hp.Headers [key];
-#endif
                                web_request.Method = hp.Method;
                                // FIXME: do we have to handle hp.QueryString ?
                                if (hp.SuppressEntityBody)