本文整理汇总了C#中Fiddler.Session.HTTPMethodIs方法的典型用法代码示例。如果您正苦于以下问题:C# Session.HTTPMethodIs方法的具体用法?C# Session.HTTPMethodIs怎么用?C# Session.HTTPMethodIs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fiddler.Session
的用法示例。
在下文中一共展示了Session.HTTPMethodIs方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BeforeRequest
public static void BeforeRequest(Session oS)
{
var file = oS.url.Replace('/', '_').Split('?').First();
var method = oS.HTTPMethodIs("GET") ? "GET"
: oS.HTTPMethodIs("POST") ? "POST"
: oS.HTTPMethodIs("PUT") ? "PUT" : null;
oS.utilCreateResponseAndBypassServer();
var lines = File.ReadAllLines("./Api/Data/" + method + " " + file + ".txt");
oS.oResponse.headers = Parser.ParseResponse(lines.First());
oS.oResponse.headers.Add("Content-Type", "application/json");
oS.utilSetResponseBody(String.Join(Environment.NewLine, lines.Skip(2).ToArray()));
}
示例2: InterceptRequest
private void InterceptRequest(Session session)
{
if (!session.hostname.EndsWith(s3Configuration.ServiceUrl))
{
return;
}
if (session.HTTPMethodIs("CONNECT"))
{
session.oFlags["x-replywithtunnel"] = "fake tunnel";
return;
}
string bucket = string.Empty;
if (!session.HostnameIs(s3Configuration.ServiceUrl))
{
string virtualHostedPath = session.hostname.Replace("." + s3Configuration.ServiceUrl, string.Empty);
bucket = "/" + virtualHostedPath;
}
if(session.isHTTPS)
{
session.fullUrl = session.fullUrl.Replace("https", "http");
}
session.host = string.Format("127.0.0.1:{0}", s3Configuration.HostPort);
session.PathAndQuery = string.Format("{0}{1}", bucket, session.PathAndQuery);
}
示例3: AutoTamperRequestBefore
public void AutoTamperRequestBefore(Session session)
{
if (Settings.enabled && session.HostnameIs(reportHost) && !session.isFTP)
{
// TODO: We should offer an option to hide the reports from Fiddler; change "ui-strikeout" to "ui-hide" in the next line
session["ui-strikeout"] = "CSPReportGenerator";
if (!session.HTTPMethodIs("CONNECT"))
{
session.utilCreateResponseAndBypassServer();
session.oResponse.headers.Add("Content-Type", "text/html");
session.ResponseBody = Encoding.UTF8.GetBytes("<!doctype html><HTML><BODY><H1>Report received.</H1></BODY></HTML>");
ProcessCSPReport(session);
}
else
{
session["x-replywithtunnel"] = "CSPReportGenerator";
}
}
}
示例4: OnFiddlerResponseReceived
void OnFiddlerResponseReceived(Session oSession)
{
if (oSession.HTTPMethodIs("CONNECT"))
{
// iOS 10.0 beta bug. rdar://problem/27423535
oSession.ResponseHeaders.Remove("Connection");
}
}
示例5: checkUrlType
// 패턴 체크 실행
void checkUrlType(HostCheck patternCheck, Session oSession)
{
if (oSession.HTTPMethodIs("CONNECT")) {
oSession.hostname = patternCheck.afterHost();
} else {
oSession.fullUrl = patternCheck.afterUrl(oSession.fullUrl);
}
}
示例6: checkHost
// HOST, URL, REAL 타입체크
void checkHost(Session oSession)
{
HostCheck patternCheck = PLinkCore.PLink.host.checkPattern(oSession.fullUrl);
if (patternCheck != null && patternCheck.Checked) {
checkUrlType(patternCheck, oSession);
//return;
}
HostCheck check = PLinkCore.PLink.host.checkUrl(oSession.hostname, oSession.PathAndQuery);
if (check == null) return;
if (!check.Checked) return;
// Host, Real 적용
if (check.isHost() || check.isReal()) {
if (oSession.HTTPMethodIs("CONNECT")) {
oSession.hostname = check.afterHost();
} else {
oSession.bypassGateway = true;
oSession["x-overrideHost"] = check.After;
}
}
// URL, PATTERN 적용
else if (check.isUrl() || check.isPattern()) {
if (oSession.HTTPMethodIs("CONNECT")) {
oSession.hostname = check.afterHost();
} else {
// 캐쉬된 정책 적용
string redirect = check.getHostItem().Redirect;
if (!string.IsNullOrEmpty(redirect)) {
check.After = redirect;
}
oSession.fullUrl = check.afterUrl(oSession.fullUrl);
}
}
}
示例7: checkUrlType
// 패턴 체크 실행
bool checkUrlType(HostCheck patternCheck, Session oSession)
{
if (oSession.HTTPMethodIs("CONNECT")) {
oSession.hostname = patternCheck.afterHost();
} else {
if (patternCheck.isStatus()) {
int code = patternCheck.getStatusCode();
sendResponse(oSession, code, "text/html", new byte[0]);
return false;
}
if (patternCheck.isFolder() || patternCheck.isFile()) {
string url = oSession.fullUrl;
int idx = url.LastIndexOf(patternCheck.Before);
FileInfo file;
string target;
if (patternCheck.isFolder()) {
string first = url.Substring(0, idx);
string second = patternCheck.Before;
string last = url.Replace(first, "").Replace(second, "");
log(first + " : " + second + " : " + last);
if (string.IsNullOrEmpty(last) || last.Equals("/")) {
last = "/index.html";
}
if (last[0] != '/') { last = "/" + last; }
target = patternCheck.After + last;
} else {
target = patternCheck.After;
}
file = new FileInfo(target);
if (file.Exists) {
string content_type = MimeType.Get(file.Extension);
byte[] data = File.ReadAllBytes(file.FullName);
sendResponse(oSession, 200, content_type, data);
return false;
}
} else {
oSession.fullUrl = patternCheck.afterUrl(oSession.fullUrl);
}
}
return true;
}