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

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs')
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs36
1 files changed, 27 insertions, 9 deletions
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs
index 722f1d2a681..3be915cfbc8 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs
@@ -45,6 +45,7 @@ namespace System.Web.Services.Protocols {
CookieContainer cookieContainer;
IWebProxy proxy;
string userAgent;
+ CookieCollection prevCookies;
#if NET_1_1
bool _unsafeAuthenticated;
@@ -116,25 +117,41 @@ namespace System.Web.Services.Protocols {
#region Methods
- internal virtual void CheckForCookies (HttpWebResponse response)
+ internal virtual void AddCookies (Uri uri)
{
- CookieCollection cookies = response.Cookies;
- if (cookieContainer == null || cookies.Count == 0)
+ if (cookieContainer == null)
+ cookieContainer = new CookieContainer ();
+
+ if (prevCookies == null || prevCookies.Count == 0)
return;
CookieCollection coll = cookieContainer.GetCookies (uri);
- foreach (Cookie c in cookies) {
- bool add = true;
- foreach (Cookie prev in coll) {
+ foreach (Cookie prev in prevCookies) {
+ bool dont = false;
+ foreach (Cookie c in coll) {
if (c.Equals (prev)) {
- add = false;
+ dont = true;
break;
}
}
- if (add)
- cookieContainer.Add (c);
+
+ if (dont == false)
+ cookieContainer.Add (prev);
}
}
+
+ internal virtual void CheckForCookies (HttpWebResponse response)
+ {
+ CookieCollection cookies = response.Cookies;
+ if (cookies.Count == 0)
+ return;
+
+ if (prevCookies == null)
+ prevCookies = new CookieCollection ();
+
+ foreach (Cookie c in cookies)
+ prevCookies.Add (c);
+ }
protected override WebRequest GetWebRequest (Uri uri)
{
@@ -147,6 +164,7 @@ namespace System.Web.Services.Protocols {
if (clientCertificates != null)
request.ClientCertificates.AddRange (clientCertificates);
+ AddCookies (uri);
request.CookieContainer = cookieContainer;
if (proxy != null)
request.Proxy = proxy;