|
|
|
@ -331,7 +331,8 @@ namespace UMC.Proxy
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<String> OuterCookies = new List<string>();
|
|
|
|
|
|
|
|
|
|
HashSet<String> OuterCookies = new HashSet<string>();
|
|
|
|
|
public int StaticModel
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
@ -846,7 +847,12 @@ namespace UMC.Proxy
|
|
|
|
|
var res = (this.Domain.Host.Equals(getUrl.Host) ? this.Reqesut(webr) : webr).Net(Method, valResult);
|
|
|
|
|
var cs = res.Headers.GetValues("Set-Cookie");
|
|
|
|
|
if (cs != null)
|
|
|
|
|
OuterCookies.AddRange(cs);
|
|
|
|
|
{
|
|
|
|
|
foreach (var c in cs)
|
|
|
|
|
{
|
|
|
|
|
OuterCookies.Add(c);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (this.IsLog == true)
|
|
|
|
|
{
|
|
|
|
|
this.Loger.Write(Method);
|
|
|
|
@ -900,9 +906,13 @@ namespace UMC.Proxy
|
|
|
|
|
var res2 = (this.Domain.Host.Equals(getUrl.Host) ? this.Reqesut(webr2) : webr2).Get();
|
|
|
|
|
var cs2 = res2.Headers.GetValues("Set-Cookie");
|
|
|
|
|
if (cs2 != null)
|
|
|
|
|
OuterCookies.AddRange(cs2);
|
|
|
|
|
{
|
|
|
|
|
foreach (var c in cs2)
|
|
|
|
|
{
|
|
|
|
|
OuterCookies.Add(c);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// OuterCookies.AddRange(res2.Headers.GetValues("Set-Cookie"));
|
|
|
|
|
if (this.IsLog == true)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
@ -1857,7 +1867,6 @@ namespace UMC.Proxy
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// var cookie = this.Cookies(key);
|
|
|
|
|
var cookie = this.Context.Cookies[key];
|
|
|
|
|
if (String.IsNullOrEmpty(cookie) == false)
|
|
|
|
|
{
|
|
|
|
@ -2142,7 +2151,12 @@ namespace UMC.Proxy
|
|
|
|
|
}
|
|
|
|
|
var cs = httpResponse.Headers.GetValues("Set-Cookie");
|
|
|
|
|
if (cs != null)
|
|
|
|
|
OuterCookies.AddRange(cs);
|
|
|
|
|
{
|
|
|
|
|
foreach (var c in cs)
|
|
|
|
|
{
|
|
|
|
|
OuterCookies.Add(c);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (this.IsLog == true)
|
|
|
|
|
{
|
|
|
|
|
this.Loger.WriteLine("{0} {1} {2}", httpResponse.ProtocolVersion, (int)httpResponse.StatusCode, httpResponse.StatusDescription);
|
|
|
|
@ -2405,7 +2419,7 @@ namespace UMC.Proxy
|
|
|
|
|
}
|
|
|
|
|
if (login.ContainsKey("IsNotCookieClear") == false)
|
|
|
|
|
{
|
|
|
|
|
this.Cookies = new NetCookieContainer();
|
|
|
|
|
this.Cookies = new CookieContainer();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var feildConfig = UMC.Data.JSON.Deserialize<Hashtable>(this.SiteCookie.Config) ?? new Hashtable();
|
|
|
|
@ -2789,30 +2803,17 @@ namespace UMC.Proxy
|
|
|
|
|
bool SaveCookie()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// if (IsChangeUser == false || this.StaticModel == 0)
|
|
|
|
|
// {
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
var siteCookie = new Entities.Cookie
|
|
|
|
|
if (this.IsChangeUser == true)
|
|
|
|
|
{
|
|
|
|
|
Domain = this.Site.Root,
|
|
|
|
|
Time = DateTime.Now,
|
|
|
|
|
user_id = this.SiteCookie.user_id,
|
|
|
|
|
IndexValue = this.SiteCookie.IndexValue
|
|
|
|
|
var siteCookie = new Entities.Cookie
|
|
|
|
|
{
|
|
|
|
|
Domain = this.Site.Root,
|
|
|
|
|
Time = DateTime.Now,
|
|
|
|
|
user_id = this.SiteCookie.user_id,
|
|
|
|
|
IndexValue = this.SiteCookie.IndexValue
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
// String strCol = UMC.Data.JSON.Serialize(this.Cookies);
|
|
|
|
|
// var isSaveCookie = false;
|
|
|
|
|
// if (String.Equals(strCol, this.SiteCookie.Cookies) == false)
|
|
|
|
|
// {
|
|
|
|
|
// siteCookie.Cookies = strCol;
|
|
|
|
|
// this.SiteCookie.Cookies = strCol;
|
|
|
|
|
// isSaveCookie = true;
|
|
|
|
|
// }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (this.IsChangeUser == true)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var nUP = String.Format("{0}{1}", this.SiteCookie.Account, this.Password);
|
|
|
|
|
|
|
|
|
@ -2841,19 +2842,6 @@ namespace UMC.Proxy
|
|
|
|
|
siteCookie.Config = this.SiteCookie.Config;
|
|
|
|
|
siteCookie.LoginTime = UMC.Data.Utility.TimeSpan();
|
|
|
|
|
this.IsChangeUser = null;
|
|
|
|
|
// isSaveCookie = true;
|
|
|
|
|
DataFactory.Instance().Put(siteCookie);
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// if (isSaveCookie)
|
|
|
|
|
// {
|
|
|
|
|
// DataFactory.Instance().Put(siteCookie);
|
|
|
|
|
// return true;
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
if (this.SiteCookie.Time < DateTime.Now.AddSeconds(-300))
|
|
|
|
|
{
|
|
|
|
|
DataFactory.Instance().Put(siteCookie);
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
@ -3116,10 +3104,10 @@ namespace UMC.Proxy
|
|
|
|
|
|
|
|
|
|
LogWrite(this.Context, this.Site, this.Context.StatusCode, String.Format("{0} {1}", Context.HttpMethod, this.RawUrl), this.SiteCookie.Account, (int)(UMC.Data.Reflection.TimeSpanMilli(DateTime.Now) - StartTime), m_HttpHeaders, _AttachmentFile);
|
|
|
|
|
|
|
|
|
|
if (this.Site.Site.AuthType > WebAuthType.All)
|
|
|
|
|
{
|
|
|
|
|
this.SaveCookie();
|
|
|
|
|
}
|
|
|
|
|
// if (this.Site.Site.AuthType > WebAuthType.All)
|
|
|
|
|
// {
|
|
|
|
|
this.SaveCookie();
|
|
|
|
|
// }
|
|
|
|
|
if (this.IsLog && User.IsAuthenticated)
|
|
|
|
|
{
|
|
|
|
|
this.Loger.WriteLine("Cookie:{0}", this.Cookies.GetCookieHeader(this.Domain));
|
|
|
|
@ -3280,7 +3268,7 @@ namespace UMC.Proxy
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.Cookies = new NetCookieContainer();
|
|
|
|
|
this.Cookies = new CookieContainer();
|
|
|
|
|
this.Login(true, false, form, String.Empty);
|
|
|
|
|
this.ProcessEnd();
|
|
|
|
|
return;
|
|
|
|
|