public static string GetRequestHtml(HarRequest harrequest, params Cookie[] c) { web = new WebBrowser(); var r = web.Request(harrequest, c); return(r.PageSource); }
public static ResponsePack_WebBrowser GetRequest(HarRequest harrequest, params Cookie[] c) { web = new WebBrowser(); var r = web.Request(harrequest, c); return((ResponsePack_WebBrowser)r); }
private void FetchRequestHeaders( long connectTimeInMilliseconds, IPEndPoint sourceEndpoint, IPEndPoint targetEndpoint) { FetchLine(); var match = _line.MatchAgainst(ParsingHelper.RequestHeadersMarkerRegex); if (!match.Success) { throw new InvalidOperationException($"Request header was expected at line {_lineIndex}."); } var url = match.GetSucceededGroupValue(ParsingHelper.UrlGroupName); var size = match.GetSucceededGroupValue(ParsingHelper.SizeGroupName).ParseLong(); var frameId = match.GetSucceededGroupValue(ParsingHelper.FrameIdGroupName).ParseNullableLong(); var internalId = match.GetSucceededGroupValue(ParsingHelper.InternalIdGroupName).ParseLong(); var startTime = GetTime(match); if (frameId.HasValue || _harPage == null) { _harPage = new HarPage { Id = $"page_{++_pageUniqueId}", Title = url, StartedDateTime = startTime }; _harPages.EnsureNotNull().Add(_harPage); } var harRequest = new HarRequest { HeadersSize = size, Url = url, BodySize = 0 }; var harEntryTimings = new HarEntryTimings { Blocked = HarConstants.NotApplicableTiming, Dns = HarConstants.NotApplicableTiming, Connect = connectTimeInMilliseconds, Ssl = HarConstants.NotApplicableTiming, Send = 0 //// Currently, it's technically impossible to determine the 'send' timing value }; var harEntry = new HarEntry { PageRef = _harPage.Id, ConnectionId = sourceEndpoint.Port.ToString(CultureInfo.InvariantCulture), ServerIPAddress = targetEndpoint.Address.ToString(), StartedDateTime = startTime, Request = harRequest, Response = new HarResponse { BodySize = 0, Content = new HarContent() }, Timings = harEntryTimings }; AddHarEntry(harEntry, internalId, url); var multilineString = FetchMultipleLines(); var requestLineString = multilineString.Lines.FirstOrDefault(); var httpRequestLineMatch = requestLineString.MatchAgainst(ParsingHelper.HttpRequestLineRegex); if (!httpRequestLineMatch.Success) { throw new InvalidOperationException( $"An HTTP Request-Line was expected at line {multilineString.LineIndexRange.Lower}."); } harRequest.Method = httpRequestLineMatch.GetSucceededGroupValue(ParsingHelper.HttpMethodGroupName); harRequest.HttpVersion = httpRequestLineMatch.GetSucceededGroupValue(ParsingHelper.HttpVersionGroupName); var harHeaders = ParseHttpHeaders(multilineString); harRequest.Headers = harHeaders; }
public string SingleSpiderRequestEntryHtml(HarRequest harrequest, params Cookie[] c) { throw new NotImplementedException(); }
public string BrowserRequestHtml(HarRequest harrequest, params Cookie[] c) { return(Request.GetRequestHtml(harrequest, c)); }
public ResponsePack_WebBrowser BrowserRequest(HarRequest harrequest, params Cookie[] c) { return(Request.GetRequest(harrequest, c)); }