public old.HttpRequestParameters_v1 GetHttpRequestParameters() { old.HttpRequestParameters_v1 requestParameters = new old.HttpRequestParameters_v1(); requestParameters.method = HttpTools.GetHttpRequestMethod(method); foreach (HttpArchiveHeader header in headers) { switch (header.name.ToLower()) { case "accept": requestParameters.accept = header.value; break; case "user-agent": requestParameters.userAgent = header.value; break; case "referer": requestParameters.referer = header.value; break; case "host": case "connection": case "if-modified-since": case "accept-encoding": break; //case "cookie": // break; //case "host": //case "accept-encoding": //case "accept-language": //case "connection": //case "if-modified-since": //case "cache-control": default: requestParameters.headers.Add(header.name, header.value); break; } } Uri uri = new Uri(url); foreach (HttpArchiveCookie cookie in cookies) { Cookie cookie2 = cookie.GetCookie(uri.DnsSafeHost); requestParameters.cookies.Add(cookie2); } //queryString //postData return(requestParameters); }
public static HttpRequest CreateHttpRequest(string url, HttpRequestParameters_v1 requestParameters) { HttpRequest httpRequest = new HttpRequest(); httpRequest.Url = url; if (requestParameters != null) { httpRequest.Method = requestParameters.method; httpRequest.Content = requestParameters.content; httpRequest.Referer = requestParameters.referer; } return(httpRequest); }
public static HttpRequestParameters CreateHttpRequestParameters(HttpRequestParameters_v1 requestParameters) { HttpRequestParameters requestParameters_new = new HttpRequestParameters(); if (requestParameters != null) { requestParameters_new.Accept = requestParameters.accept; requestParameters_new.AutomaticDecompression = requestParameters.automaticDecompression; requestParameters_new.ContentType = requestParameters.contentType; requestParameters_new.Cookies = requestParameters.cookies; requestParameters_new.Encoding = requestParameters.encoding; requestParameters_new.Expect100Continue = requestParameters.Expect100Continue; requestParameters_new.Headers = requestParameters.headers; requestParameters_new.UserAgent = requestParameters.userAgent; } return(requestParameters_new); }
public static bool LoadToFile(string url, string file, bool exportRequest = false, HttpRequestParameters_v1 requestParameters = null) { return(HttpManager.CurrentHttpManager.LoadToFile(CreateHttpRequest(url, requestParameters), file, exportRequest, CreateHttpRequestParameters(requestParameters))); }
public static bool LoadUrl(string url, HttpRequestParameters_v1 requestParameters = null) { __http = HttpManager.CurrentHttpManager.Load(CreateHttpRequest(url, requestParameters), CreateHttpRequestParameters(requestParameters)); return(__http != null); }