public Session SendRequest(string sRequest, StringDictionary oNewFlags) { byte[] bytes = CONFIG.oHeaderEncoding.GetBytes(sRequest); int count; int num; HTTPHeaderParseWarnings hTTPHeaderParseWarnings; if (!Parser.FindEntityBodyOffsetFromArray(bytes, out count, out num, out hTTPHeaderParseWarnings)) { throw new ArgumentException("sRequest did not represent a valid HTTP request", "sRequest"); } string sHeaders = CONFIG.oHeaderEncoding.GetString(bytes, 0, count) + "\r\n\r\n"; HTTPRequestHeaders hTTPRequestHeaders = new HTTPRequestHeaders(); if (!hTTPRequestHeaders.AssignFromString(sHeaders)) { throw new ArgumentException("sRequest did not contain valid HTTP headers", "sRequest"); } byte[] array; if (1 > bytes.Length - num) { array = Utilities.emptyByteArray; } else { array = new byte[bytes.Length - num]; Buffer.BlockCopy(bytes, num, array, 0, array.Length); } return(this.SendRequest(hTTPRequestHeaders, array, oNewFlags)); }
public Session SendRequest(HTTPRequestHeaders oHeaders, byte[] arrRequestBodyBytes, StringDictionary oNewFlags, EventHandler <StateChangeEventArgs> onStateChange) { if (oHeaders.ExistsAndContains("Fiddler-Encoding", "base64")) { oHeaders.Remove("Fiddler-Encoding"); if (!Utilities.IsNullOrEmpty(arrRequestBodyBytes)) { arrRequestBodyBytes = Convert.FromBase64String(Encoding.ASCII.GetString(arrRequestBodyBytes)); if (oNewFlags == null) { oNewFlags = new StringDictionary(); } oNewFlags["x-Builder-FixContentLength"] = "CFE-required"; } } if (oHeaders.Exists("Fiddler-Host")) { if (oNewFlags == null) { oNewFlags = new StringDictionary(); } oNewFlags["x-OverrideHost"] = oHeaders["Fiddler-Host"]; oNewFlags["X-IgnoreCertCNMismatch"] = "Overrode HOST"; oHeaders.Remove("Fiddler-Host"); } if (oNewFlags != null && oNewFlags.ContainsKey("x-Builder-FixContentLength")) { if (arrRequestBodyBytes != null && !oHeaders.ExistsAndContains("Transfer-Encoding", "chunked")) { if (!Utilities.HTTPMethodAllowsBody(oHeaders.HTTPMethod) && arrRequestBodyBytes.Length == 0) { oHeaders.Remove("Content-Length"); } else { oHeaders["Content-Length"] = arrRequestBodyBytes.LongLength.ToString(); } } else { oHeaders.Remove("Content-Length"); } } Session session = new Session((HTTPRequestHeaders)oHeaders.Clone(), arrRequestBodyBytes); session.SetBitFlag(SessionFlags.RequestGeneratedByFiddler, true); if (onStateChange != null) { session.OnStateChanged += onStateChange; } if (oNewFlags != null && oNewFlags.Count > 0) { foreach (DictionaryEntry dictionaryEntry in oNewFlags) { session.oFlags[(string)dictionaryEntry.Key] = oNewFlags[(string)dictionaryEntry.Key]; } } session.ExecuteUponAsyncRequest(); return(session); }
public Session SendRequest(string sRequest, StringDictionary oNewFlags) { int num; int num2; HTTPHeaderParseWarnings warnings; byte[] buffer2; byte[] bytes = CONFIG.oHeaderEncoding.GetBytes(sRequest); if (!Parser.FindEntityBodyOffsetFromArray(bytes, out num, out num2, out warnings)) { throw new ArgumentException("sRequest did not represent a valid HTTP request", "sRequest"); } string sHeaders = CONFIG.oHeaderEncoding.GetString(bytes, 0, num) + "\r\n\r\n"; HTTPRequestHeaders oHeaders = new HTTPRequestHeaders(); if (!oHeaders.AssignFromString(sHeaders)) { throw new ArgumentException("sRequest did not contain valid HTTP headers", "sRequest"); } if (1 > (bytes.Length - num2)) { buffer2 = new byte[0]; } else { buffer2 = new byte[bytes.Length - num2]; Buffer.BlockCopy(bytes, num2, buffer2, 0, buffer2.Length); } return(this.SendRequest(oHeaders, buffer2, oNewFlags)); }
public static bool TakeRequest(MemoryStream strmClient, out HTTPRequestHeaders headersRequest, out byte[] arrRequestBody) { headersRequest = null; arrRequestBody = Utilities.emptyByteArray; if (strmClient.Length - strmClient.Position < 16L) { return(false); } byte[] buffer = strmClient.GetBuffer(); long length = strmClient.Length; int num = (int)strmClient.Position; HTTPHeaderParseWarnings hTTPHeaderParseWarnings; if (!Parser.FindEndOfHeaders(buffer, ref num, length, out hTTPHeaderParseWarnings)) { return(false); } byte[] array = new byte[(long)(1 + num) - strmClient.Position]; strmClient.Read(array, 0, array.Length); string @string = CONFIG.oHeaderEncoding.GetString(array); headersRequest = Parser.ParseRequest(@string); if (headersRequest != null) { int num2 = Parser._GetEntityLengthFromHeaders(headersRequest, strmClient); arrRequestBody = new byte[num2]; strmClient.Read(arrRequestBody, 0, arrRequestBody.Length); return(true); } return(false); }
public override bool AssignFromString(string sHeaders) { if (string.IsNullOrEmpty(sHeaders)) { throw new ArgumentException("Header string must not be null or empty"); } if (!sHeaders.Contains("\r\n\r\n")) { sHeaders += "\r\n\r\n"; } HTTPRequestHeaders hTTPRequestHeaders = null; try { hTTPRequestHeaders = Parser.ParseRequest(sHeaders); } catch (Exception) { } if (hTTPRequestHeaders == null) { return(false); } this.HTTPMethod = hTTPRequestHeaders.HTTPMethod; this._Path = hTTPRequestHeaders._Path; this._RawPath = hTTPRequestHeaders._RawPath; this._UriScheme = hTTPRequestHeaders._UriScheme; this.HTTPVersion = hTTPRequestHeaders.HTTPVersion; this._uriUserInfo = hTTPRequestHeaders._uriUserInfo; this.storage = hTTPRequestHeaders.storage; return(true); }
private bool isRequestComplete() { if (this.m_headers == null) { if (!this.HeadersAvailable()) { return(false); } if (!this.ParseRequestForHeaders()) { string str; if (this.m_requestData != null) { str = Utilities.ByteArrayToHexView(this.m_requestData.GetBuffer(), 0x18, (int)Math.Min(this.m_requestData.Length, 0x800L)); } else { str = "{Fiddler:no data}"; } if (this.m_headers == null) { this.m_headers = new HTTPRequestHeaders(); this.m_headers.HTTPMethod = "BAD"; this.m_headers["Host"] = "BAD-REQUEST"; this.m_headers.RequestPath = "/BAD_REQUEST"; } this.FailSession(400, "Fiddler - Bad Request", "[Fiddler] Request Header parsing failed. Request was:\n" + str); return(true); } this.m_session._AssignID(); FiddlerApplication.DoRequestHeadersAvailable(this.m_session); } if (this.m_headers.ExistsAndEquals("Transfer-encoding", "chunked")) { long num; long num2; return(Utilities.IsChunkedBodyComplete(this.m_session, this.m_requestData, (long)this.iEntityBodyOffset, out num2, out num)); } if (this.m_headers.Exists("Content-Length")) { long result = 0L; try { if (!long.TryParse(this.m_headers["Content-Length"], NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out result) || (result < 0L)) { FiddlerApplication.HandleHTTPError(this.m_session, SessionFlags.ProtocolViolationInRequest, true, true, "Request content length was invalid.\nContent-Length: " + this.m_headers["Content-Length"]); this.FailSession(400, "Fiddler - Bad Request", "[Fiddler] Request Content-Length header parsing failed.\nContent-Length: " + this.m_headers["Content-Length"]); return(true); } return(this.m_requestData.Length >= (this.iEntityBodyOffset + result)); } catch { this.FailSession(400, "Fiddler - Bad Request", "[Fiddler] Unknown error: Check content length header?"); return(false); } } return(true); }
public void InjectCustomRequest(HTTPRequestHeaders oHeaders, byte[] arrRequestBodyBytes, bool bRunRequestRules, bool bViewResult) { StringDictionary oNewFlags = new StringDictionary(); oNewFlags["x-From-Builder"] = "true"; if (bViewResult) { oNewFlags["x-Builder-Inspect"] = "1"; } this.InjectCustomRequest(oHeaders, arrRequestBodyBytes, oNewFlags); }
public object Clone() { HTTPRequestHeaders hTTPRequestHeaders = (HTTPRequestHeaders)base.MemberwiseClone(); hTTPRequestHeaders.storage = new List <HTTPHeaderItem>(this.storage.Count); foreach (HTTPHeaderItem current in this.storage) { hTTPRequestHeaders.storage.Add((HTTPHeaderItem)current.Clone()); } return(hTTPRequestHeaders); }
public object Clone() { HTTPRequestHeaders headers = (HTTPRequestHeaders)base.MemberwiseClone(); headers.storage = new List <HTTPHeaderItem>(base.storage.Count); foreach (HTTPHeaderItem item in base.storage) { headers.storage.Add((HTTPHeaderItem)item.Clone()); } return(headers); }
public Session SendRequest(HTTPRequestHeaders oHeaders, byte[] arrRequestBodyBytes, StringDictionary oNewFlags) { Session session = new Session((HTTPRequestHeaders)oHeaders.Clone(), arrRequestBodyBytes); session.SetBitFlag(SessionFlags.RequestGeneratedByFiddler, true); if ((oNewFlags != null) && (oNewFlags.Count > 0)) { foreach (DictionaryEntry entry in oNewFlags) { session.oFlags[(string)entry.Key] = oNewFlags[(string)entry.Key]; } } ThreadPool.UnsafeQueueUserWorkItem(new WaitCallback(session.Execute), null); return(session); }
public Session SendRequestAndWait(HTTPRequestHeaders oHeaders, byte[] arrRequestBodyBytes, StringDictionary oNewFlags, EventHandler <StateChangeEventArgs> onStateChange) { ManualResetEvent oMRE = new ManualResetEvent(false); Session session = this.SendRequest(oHeaders, arrRequestBodyBytes, oNewFlags, onStateChange); session.OnStateChanged += delegate(object sender, StateChangeEventArgs e) { if (e.newState >= SessionStates.Done) { FiddlerApplication.DebugSpew("SendRequestAndWait Session #{0} reached state {1}", new object[] { (sender as Session).Int32_0, e.newState }); oMRE.Set(); } }; oMRE.WaitOne(); return(session); }
public bool AssignFromString(string sHeaders) { HTTPRequestHeaders headers = null; try { headers = Parser.ParseRequest(sHeaders); } catch (Exception) { } if (headers != null) { this.HTTPMethod = headers.HTTPMethod; this._Path = headers._Path; this._RawPath = headers._RawPath; this._UriScheme = headers._UriScheme; base.HTTPVersion = headers.HTTPVersion; this._uriUserInfo = headers._uriUserInfo; base.storage = headers.storage; return(true); } return(false); }
private bool actSendRequestFromWizard(bool bBreakRequest) { this.txtBuilderURL.Text = this.txtBuilderURL.Text.Trim(); if (!this.txtBuilderURL.Text.StartsWith("http", StringComparison.OrdinalIgnoreCase)) { if (this.txtBuilderURL.Text.Contains("://")) { MessageBox.Show("Only HTTP:// and HTTPS:// URLs are supported.\n\nInvalid URI: " + this.txtBuilderURL.Text, "Invalid URI"); return(false); } this.txtBuilderURL.Text = "http://" + this.txtBuilderURL.Text; } bool flag = this.txtBuilderURL.Text.Contains("#"); int result = 0; int num2 = 10; if (flag) { string s = string.Empty; string str = frmPrompt.GetUserString("Sequential Requests Starting At", "All instances of the # character will be replaced with a consecutive integer starting at: ", "0", true); if (str == null) { flag = false; } if (flag) { s = frmPrompt.GetUserString("Sequential Requests Ending At", "End at: ", "10", true); if (s == null) { flag = false; } } if (flag && (!int.TryParse(str, out result) || !int.TryParse(s, out num2))) { flag = false; } } try { StringBuilder builder; Label_0108: builder = new StringBuilder(0x400); string text = this.txtBuilderURL.Text; if (flag) { text = text.Replace("#", result.ToString()); } builder.AppendFormat("{0} {1} {2}\r\n", this.cbxBuilderMethod.Text, text, this.cbxBuilderHTTPVersion.Text); builder.Append(this.txtBuilderRequestHeaders.Text.Trim()); builder.Append("\r\n\r\n"); HTTPRequestHeaders oHeaders = Parser.ParseRequest(builder.ToString()); builder = null; byte[] bytes = Utilities.getEntityBodyEncoding(oHeaders, null).GetBytes(this.txtBuilderRequestBody.Text); string str4 = this.txtBuilderURL.Text; int index = str4.IndexOf("//", StringComparison.Ordinal); if (index > -1) { str4 = str4.Substring(index + 2); } int length = str4.IndexOfAny(new char[] { '/', '?' }); if (length > -1) { str4 = str4.Substring(0, length).ToLower(); } oHeaders["Host"] = str4; if (flag && oHeaders.ExistsAndContains("Host", "#")) { oHeaders["Host"] = oHeaders["Host"].Replace("#", result.ToString()); } if ((this.cbFixContentLength.Checked && (oHeaders.Exists("Content-Length") || (bytes.Length > 0))) && !oHeaders.ExistsAndContains("Transfer-Encoding", "chunked")) { oHeaders["Content-Length"] = bytes.Length.ToString(); } this.txtBuilderRequestHeaders.Text = oHeaders.ToString(false, false); Session session = new Session((HTTPRequestHeaders)oHeaders.Clone(), bytes); session.SetBitFlag(SessionFlags.RequestGeneratedByFiddler, true); session.oFlags["x-From-Builder"] = "true"; bool flag2 = this.cbSelectBuilderResult.Checked; if (bBreakRequest) { session.oFlags["x-breakrequest"] = "Builder"; flag2 = true; } if (flag) { if (session.oRequest.headers.ExistsAndContains("Referer", "#")) { session.oRequest["Referer"] = session.oRequest["Referer"].Replace("#", result.ToString()); } } else if (flag2) { session.oFlags["x-Builder-Inspect"] = "1"; } if (this.cbAutoAuthenticate.Checked) { session.oFlags["x-AutoAuth"] = "(default)"; } if (this.cbFollowRedirects.Checked) { session.oFlags["x-Builder-MaxRedir"] = FiddlerApplication.Prefs.GetInt32Pref("fiddler.requestbuilder.followredirects.max", 10).ToString(); } ThreadPool.UnsafeQueueUserWorkItem(new WaitCallback(session.Execute), null); if (flag && (result < num2)) { result++; goto Label_0108; } return(true); } catch (Exception exception) { FiddlerApplication.DoNotifyUser(exception.Message, "Custom Request Failed"); return(false); } }
public static HTTPRequestHeaders ParseRequest(string sRequest) { HTTPRequestHeaders oHeaders = new HTTPRequestHeaders(CONFIG.oHeaderEncoding); string[] sHeaderLines = sRequest.Substring(0, sRequest.IndexOf("\r\n\r\n", StringComparison.Ordinal)).Replace("\r\n", "\n").Split(new char[] { '\n' }); if (sHeaderLines.Length >= 1) { int index = sHeaderLines[0].IndexOf(' '); if (index > 0) { oHeaders.HTTPMethod = sHeaderLines[0].Substring(0, index).ToUpper(); sHeaderLines[0] = sHeaderLines[0].Substring(index).Trim(); } index = sHeaderLines[0].LastIndexOf(' '); if (index > 0) { oHeaders.RequestPath = sHeaderLines[0].Substring(0, index); oHeaders.HTTPVersion = sHeaderLines[0].Substring(index).Trim().ToUpper(); if (oHeaders.RequestPath.StartsWith("http://", StringComparison.OrdinalIgnoreCase)) { oHeaders.UriScheme = "http"; index = oHeaders.RequestPath.IndexOfAny(new char[] { '/', '?' }, 7); if (index == -1) { oHeaders.RequestPath = "/"; } else { oHeaders.RequestPath = oHeaders.RequestPath.Substring(index); } } else if (oHeaders.RequestPath.StartsWith("https://", StringComparison.OrdinalIgnoreCase)) { oHeaders.UriScheme = "https"; index = oHeaders.RequestPath.IndexOfAny(new char[] { '/', '?' }, 8); if (index == -1) { oHeaders.RequestPath = "/"; } else { oHeaders.RequestPath = oHeaders.RequestPath.Substring(index); } } else if (oHeaders.RequestPath.StartsWith("ftp://", StringComparison.OrdinalIgnoreCase)) { oHeaders.UriScheme = "ftp"; index = oHeaders.RequestPath.IndexOf('/', 6); if (index == -1) { oHeaders.RequestPath = "/"; } else { oHeaders.RequestPath = oHeaders.RequestPath.Substring(index); } } string sErrors = string.Empty; ParseNVPHeaders(oHeaders, sHeaderLines, 1, ref sErrors); return(oHeaders); } } return(null); }
private bool ParseRequestForHeaders() { if (this.m_requestData == null || this.iEntityBodyOffset < 4) { return(false); } this.m_headers = new HTTPRequestHeaders(CONFIG.oHeaderEncoding); byte[] buffer = this.m_requestData.GetBuffer(); int num; int num2; int num3; string text; Parser.CrackRequestLine(buffer, out num, out num2, out num3, out text); if (num >= 1 && num2 >= 1) { if (!string.IsNullOrEmpty(text)) { FiddlerApplication.HandleHTTPError(this.m_session, SessionFlags.ProtocolViolationInRequest, true, false, text); } string @string = Encoding.ASCII.GetString(buffer, 0, num - 1); this.m_headers.HTTPMethod = @string.ToUpperInvariant(); if (@string != this.m_headers.HTTPMethod) { FiddlerApplication.HandleHTTPError(this.m_session, SessionFlags.ProtocolViolationInRequest, false, false, string.Format("Per RFC2616, HTTP Methods are case-sensitive. Client sent '{0}', expected '{1}'.", @string, this.m_headers.HTTPMethod)); } this.m_headers.HTTPVersion = Encoding.ASCII.GetString(buffer, num + num2 + 1, num3 - num2 - num - 2).Trim().ToUpperInvariant(); int num4 = 0; if (buffer[num] != 47) { if (num2 > 7 && buffer[num + 4] == 58 && buffer[num + 5] == 47 && buffer[num + 6] == 47) { this.m_headers.UriScheme = Encoding.ASCII.GetString(buffer, num, 4); num4 = num + 6; num += 7; num2 -= 7; } else { if (num2 > 8 && buffer[num + 5] == 58 && buffer[num + 6] == 47 && buffer[num + 7] == 47) { this.m_headers.UriScheme = Encoding.ASCII.GetString(buffer, num, 5); num4 = num + 7; num += 8; num2 -= 8; } else { if (num2 > 6 && buffer[num + 3] == 58 && buffer[num + 4] == 47 && buffer[num + 5] == 47) { this.m_headers.UriScheme = Encoding.ASCII.GetString(buffer, num, 3); num4 = num + 5; num += 6; num2 -= 6; } } } } if (num4 == 0) { if (this.pipeClient != null && this.pipeClient.bIsSecured) { this.m_headers.UriScheme = "https"; } else { this.m_headers.UriScheme = "http"; } } if (num4 > 0) { if (num2 == 0) { FiddlerApplication.HandleHTTPError(this.m_session, SessionFlags.ProtocolViolationInRequest, true, false, "Incorrectly formed Request-Line. Request-URI component was missing.\r\n\r\n" + Encoding.ASCII.GetString(buffer, 0, num3)); return(false); } while (num2 > 0 && buffer[num] != 47) { if (buffer[num] == 63) { break; } num++; num2--; } int num5 = num4 + 1; int num6 = num - num5; if (num6 > 0) { this.m_sHostFromURI = CONFIG.oHeaderEncoding.GetString(buffer, num5, num6); if (this.m_headers.UriScheme == "ftp" && this.m_sHostFromURI.Contains("@")) { int num7 = this.m_sHostFromURI.LastIndexOf("@") + 1; this.m_headers._uriUserInfo = this.m_sHostFromURI.Substring(0, num7); this.m_sHostFromURI = this.m_sHostFromURI.Substring(num7); } } } byte[] array = new byte[num2]; Buffer.BlockCopy(buffer, num, array, 0, num2); this.m_headers.RawPath = array; if (string.IsNullOrEmpty(this.m_headers.RequestPath)) { FiddlerApplication.HandleHTTPError(this.m_session, SessionFlags.ProtocolViolationInRequest, false, false, "Incorrectly formed Request-Line. abs_path was empty (e.g. missing /). RFC2616 Section 5.1.2"); } string text2 = CONFIG.oHeaderEncoding.GetString(buffer, num3, this.iEntityBodyOffset - num3).Trim(); if (text2.Length >= 1) { string[] sHeaderLines = text2.Replace("\r\n", "\n").Split(new char[] { '\n' }); string empty = string.Empty; if (!Parser.ParseNVPHeaders(this.m_headers, sHeaderLines, 0, ref empty)) { FiddlerApplication.HandleHTTPError(this.m_session, SessionFlags.ProtocolViolationInRequest, true, false, "Incorrectly formed request headers.\n" + empty); } } if (this.m_headers.Exists("Content-Length") && this.m_headers.ExistsAndContains("Transfer-Encoding", "chunked")) { FiddlerApplication.HandleHTTPError(this.m_session, SessionFlags.ProtocolViolationInRequest, false, false, "Content-Length request header MUST NOT be present when Transfer-Encoding is used (RFC2616 Section 4.4)"); } return(true); } FiddlerApplication.HandleHTTPError(this.m_session, SessionFlags.ProtocolViolationInRequest, true, false, "Incorrectly formed Request-Line"); return(false); }
public static HTTPRequestHeaders ParseRequest(string sRequest) { string[] array = Parser._GetHeaderLines(sRequest); if (array == null) { return(null); } HTTPRequestHeaders hTTPRequestHeaders = new HTTPRequestHeaders(CONFIG.oHeaderEncoding); int num = array[0].IndexOf(' '); if (num > 0) { hTTPRequestHeaders.HTTPMethod = array[0].Substring(0, num).ToUpperInvariant(); array[0] = array[0].Substring(num).Trim(); } num = array[0].LastIndexOf(' '); if (num > 0) { string text = array[0].Substring(0, num); hTTPRequestHeaders.HTTPVersion = array[0].Substring(num).Trim().ToUpperInvariant(); if (text.OICStartsWith("http://")) { hTTPRequestHeaders.UriScheme = "http"; num = text.IndexOfAny(new char[] { '/', '?' }, 7); if (num == -1) { hTTPRequestHeaders.RequestPath = "/"; } else { hTTPRequestHeaders.RequestPath = text.Substring(num); } } else { if (text.OICStartsWith("https://")) { hTTPRequestHeaders.UriScheme = "https"; num = text.IndexOfAny(new char[] { '/', '?' }, 8); if (num == -1) { hTTPRequestHeaders.RequestPath = "/"; } else { hTTPRequestHeaders.RequestPath = text.Substring(num); } } else { if (text.OICStartsWith("ftp://")) { hTTPRequestHeaders.UriScheme = "ftp"; num = text.IndexOf('/', 6); if (num == -1) { hTTPRequestHeaders.RequestPath = "/"; } else { string text2 = text.Substring(6, num - 6); if (text2.Contains("@")) { hTTPRequestHeaders._uriUserInfo = Utilities.TrimTo(text2, text2.IndexOf("@") + 1); } hTTPRequestHeaders.RequestPath = text.Substring(num); } } else { hTTPRequestHeaders.RequestPath = text; } } } string empty = string.Empty; Parser.ParseNVPHeaders(hTTPRequestHeaders, array, 1, ref empty); return(hTTPRequestHeaders); } return(null); }
public Session SendRequest(HTTPRequestHeaders oHeaders, byte[] arrRequestBodyBytes, StringDictionary oNewFlags) { return(this.SendRequest(oHeaders, arrRequestBodyBytes, oNewFlags, null)); }
public void InjectCustomRequest(HTTPRequestHeaders oHeaders, byte[] arrRequestBodyBytes, StringDictionary oNewFlags) { this.SendRequest(oHeaders, arrRequestBodyBytes, oNewFlags); }
private bool ParseRequestForHeaders() { int num; int num2; int num3; if ((this.m_requestData == null) || (this.iEntityBodyOffset < 4)) { return(false); } this.m_headers = new HTTPRequestHeaders(CONFIG.oHeaderEncoding); byte[] arrRequest = this.m_requestData.GetBuffer(); Parser.CrackRequestLine(arrRequest, out num2, out num3, out num); if ((num2 < 1) || (num3 < 1)) { FiddlerApplication.HandleHTTPError(this.m_session, SessionFlags.ProtocolViolationInRequest, true, false, "Incorrectly formed Request-Line"); return(false); } this.m_headers.HTTPMethod = Encoding.ASCII.GetString(arrRequest, 0, num2 - 1).ToUpper(); this.m_headers.HTTPVersion = Encoding.ASCII.GetString(arrRequest, (num2 + num3) + 1, ((num - num3) - num2) - 2).Trim().ToUpper(); int num4 = 0; if (arrRequest[num2] != 0x2f) { if (((num3 > 7) && (arrRequest[num2 + 4] == 0x3a)) && ((arrRequest[num2 + 5] == 0x2f) && (arrRequest[num2 + 6] == 0x2f))) { this.m_headers.UriScheme = Encoding.ASCII.GetString(arrRequest, num2, 4); num4 = num2 + 6; num2 += 7; num3 -= 7; } else if (((num3 > 8) && (arrRequest[num2 + 5] == 0x3a)) && ((arrRequest[num2 + 6] == 0x2f) && (arrRequest[num2 + 7] == 0x2f))) { this.m_headers.UriScheme = Encoding.ASCII.GetString(arrRequest, num2, 5); num4 = num2 + 7; num2 += 8; num3 -= 8; } else if (((num3 > 6) && (arrRequest[num2 + 3] == 0x3a)) && ((arrRequest[num2 + 4] == 0x2f) && (arrRequest[num2 + 5] == 0x2f))) { this.m_headers.UriScheme = Encoding.ASCII.GetString(arrRequest, num2, 3); num4 = num2 + 5; num2 += 6; num3 -= 6; } } if (num4 == 0) { if ((this.pipeClient != null) && this.pipeClient.bIsSecured) { this.m_headers.UriScheme = "https"; } else { this.m_headers.UriScheme = "http"; } } if (num4 > 0) { while (((num3 > 0) && (arrRequest[num2] != 0x2f)) && (arrRequest[num2] != 0x3f)) { num2++; num3--; } if (num3 == 0) { num2 = num4; num3 = 1; } int index = num4 + 1; int count = num2 - index; if (count > 0) { this.m_sHostFromURI = CONFIG.oHeaderEncoding.GetString(arrRequest, index, count); if ((this.m_headers.UriScheme == "ftp") && this.m_sHostFromURI.Contains("@")) { int length = this.m_sHostFromURI.LastIndexOf("@") + 1; this.m_headers._uriUserInfo = this.m_sHostFromURI.Substring(0, length); this.m_sHostFromURI = this.m_sHostFromURI.Substring(length); } } } byte[] dst = new byte[num3]; Buffer.BlockCopy(arrRequest, num2, dst, 0, num3); this.m_headers.RawPath = dst; string str = CONFIG.oHeaderEncoding.GetString(arrRequest, num, this.iEntityBodyOffset - num).Trim(); arrRequest = null; if (str.Length >= 1) { string[] sHeaderLines = str.Replace("\r\n", "\n").Split(new char[] { '\n' }); string sErrors = string.Empty; if (!Parser.ParseNVPHeaders(this.m_headers, sHeaderLines, 0, ref sErrors)) { FiddlerApplication.HandleHTTPError(this.m_session, SessionFlags.ProtocolViolationInRequest, true, false, "Incorrectly formed request headers.\n" + sErrors); } } return(true); }