Beispiel #1
0
 public virtual void AddCookies(IList <Apache.Http.Cookie.Cookie> cookies)
 {
     if (cookieStore == null)
     {
         return;
     }
     lock (this)
     {
         foreach (Apache.Http.Cookie.Cookie cookie in cookies)
         {
             cookieStore.AddCookie(cookie);
         }
     }
 }
Beispiel #2
0
 public virtual void AddCookies(IList <Apache.Http.Cookie.Cookie> cookies)
 {
     lock (this)
     {
         if (cookieStore == null)
         {
             cookieStore = new BasicCookieStore();
         }
         foreach (Apache.Http.Cookie.Cookie cookie in cookies)
         {
             cookieStore.AddCookie(cookie);
         }
     }
 }
 private void ProcessCookies(HeaderIterator iterator, CookieSpec cookieSpec, CookieOrigin
                             cookieOrigin, CookieStore cookieStore)
 {
     while (iterator.HasNext())
     {
         Header header = iterator.NextHeader();
         try
         {
             IList <Apache.Http.Cookie.Cookie> cookies = cookieSpec.Parse(header, cookieOrigin);
             foreach (Apache.Http.Cookie.Cookie cookie in cookies)
             {
                 try
                 {
                     cookieSpec.Validate(cookie, cookieOrigin);
                     cookieStore.AddCookie(cookie);
                     if (this.log.IsDebugEnabled())
                     {
                         this.log.Debug("Cookie accepted [" + FormatCooke(cookie) + "]");
                     }
                 }
                 catch (MalformedCookieException ex)
                 {
                     if (this.log.IsWarnEnabled())
                     {
                         this.log.Warn("Cookie rejected [" + FormatCooke(cookie) + "] " + ex.Message);
                     }
                 }
             }
         }
         catch (MalformedCookieException ex)
         {
             if (this.log.IsWarnEnabled())
             {
                 this.log.Warn("Invalid cookie header: \"" + header + "\". " + ex.Message);
             }
         }
     }
 }