// Http params public string Param(string key) { var val = HttpStatic.Get <string>(httpParams, key); var res = val; if (val.ContainsCase("\"") || val.ContainsCase("Ė")) { res = HttpUtility.HtmlEncode(val); } return(res ?? string.Empty); }
public JsonResult SetVhostHttpStatic(string deviceId, string vhostDomain, HttpStatic httpStatic) { ResponseStruct rss = CommonFunctions.CheckParams(new object[] { deviceId, vhostDomain, httpStatic }); if (rss.Code != ErrorNumber.None) { return(Program.CommonFunctions.DelApisResult(null !, rss)); } var rt = VhostHttpStaticApis.SetVhostHttpStatic(deviceId, vhostDomain, httpStatic, out ResponseStruct rs); return(Program.CommonFunctions.DelApisResult(rt, rs)); }
public RequestInfo(IRenderXsltBase _ctrl, HttpRequest _req) { this.ctrl = _ctrl; this.req = _req; //this.user = HttpStatic.UserClaim; if (this.req != null) { httpParams = this.req.Params; } else { httpParams = HttpStatic.ParseQueryString(); } }
public bool TCPRead(string Method) { string tx = HttpStatic.HttpHeaderToStr(Method, url, httpHeader, cookies); string str1; bool ret; List <byte> btx = new List <byte>(Encoding.ASCII.GetBytes(tx)); if (Method == "POST") { btx.AddRange(PostTx); } Com.ReadTimeout = 300; ret = TCPRead(btx); string str; if (ret)//成功 { object o = TCPData.oTCPDatas; if (o == null) { return(false); } switch (TCPData.datatype) { case TCPDataType.HTTP: Http http = (Http)o; switch (http.ServerState) { case 200: if (http.ContentDatas.Count == 0) { return(true); } str = HttpStatic.ContentToStr(http); int x = str.IndexOf("onevent type=\"onenterforward\""); if (x != -1) { x = str.IndexOf("go href=\"", x); x += "go href=\"".Length; //OnAddLog("获得跳转页"); //httpHeader[HttpRequestHeader.Referer] = url; url = StringsFunction.strDecode(str.Substring(x, str.IndexOf('\"', x) - x)); if (http.Cookies.Count != 0) { foreach (Cookie c in http.Cookies) { if (cookies[c.Name] != null) { cookies[c.Name].Value = c.Value; } else { cookies.Add(c); } } } return(TCPRead(Method)); } x = str.IndexOf("<meta http-equiv=\"Refresh\""); if (x != -1) { x = str.IndexOf("<meta http-equiv=\"Refresh\"", x); x += "<meta http-equiv=\"Refresh\"".Length; x = str.IndexOf("content=\""); if (x == -1) { break; } x = x + "content=\"".Length; str1 = str.Substring(x, str.IndexOf('"', x) - x); x = str1.IndexOf(';'); if (x == -1) { break; } str1 = str1.Substring(x + ";url=".Length); //OnAddLog("获得跳转页"); httpHeader[HttpRequestHeader.Referer] = url; url = StringsFunction.strDecode(str1); if (http.Cookies.Count != 0) { foreach (Cookie c in http.Cookies) { if (cookies[c.Name] != null) { cookies[c.Name].Value = c.Value; } else { cookies.Add(c); } } } httpHeader.Remove(HttpRequestHeader.ContentLength); httpHeader.Remove(HttpRequestHeader.ContentType); return(TCPRead()); } break; case 302: //转移 try { url = http.httpHeader[HttpResponseHeader.Location]; url = ProcessURL(url); if (http.Cookies.Count != 0) { foreach (Cookie c in http.Cookies) { if (cookies[c.Name] != null) { cookies[c.Name].Value = c.Value; } else { cookies.Add(c); } } } httpHeader[HttpRequestHeader.Host] = ""; return(TCPRead(Method)); } catch (System.Exception ex) { Debug.WriteLine(ex.Message); return(false); } } break; default: return(true); } } return(ret); }