Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for the 'Origin' header: Request.Origin #143

Merged
merged 1 commit into from
Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public void write(JsonWriter writer, List<LogEntry> logEntries) throws IOExcepti
writer.name("method").value(logEntry.method);
writer.name("url").value(logEntry.url.toString());
writer.name("httpVersion").value(logEntry.requestHttpVersion);
writer.name("origin").value(logEntry.origin);

writer.name("cookies").beginArray();
if (logEntry.hasCookieParam) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public class LogEntry {
public CookieJarStatus usesCookieJar = CookieJarStatus.NO;
public String responseHash;
public String redirectURL;
public String origin = "";
// public String[] regexAllReq = {"","","","",""};
// public String[] regexAllResp = {"","","","",""};

Expand Down Expand Up @@ -235,10 +236,12 @@ private Status processRequest() {
this.usesCookieJar = CookieJarStatus.YES;
}
}
} else if (headerItem[0].equals("referer")) {
} else if (headerItem[0].equalsIgnoreCase("referer")) {
this.referrerURL = headerItem[1];
} else if (headerItem[0].equals("content-type")) {
} else if (headerItem[0].equalsIgnoreCase("content-type")) {
this.requestContentType = headerItem[1];
} else if (headerItem[0].equalsIgnoreCase("origin")) {
this.origin = headerItem[1];
}
}
}
Expand Down Expand Up @@ -598,6 +601,8 @@ public Object getValueByKey(LogEntryField columnName) {
return this.sentCookies;
case USES_COOKIE_JAR:
return this.usesCookieJar.toString();
case ORIGIN:
return this.origin;
// case REGEX1REQ:
// return this.regexAllReq[0];
// case REGEX2REQ:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public enum LogEntryField {
SENTCOOKIES(FieldGroup.REQUEST, Boolean.class, "The value of the cookies header sent to the server.", "CookieString", "SentCookies", "Cookies"),
PARAMETER_COUNT(FieldGroup.REQUEST, Integer.class, "The number of parameters in the request.", "ParameterCount", "ParamCount"),
PARAMETERS(FieldGroup.REQUEST, String.class, "The parameters in the request.", "Parameters", "Params"),
ORIGIN(FieldGroup.REQUEST, String.class, "The Origin header", "Origin"),

//Response
BASE64_RESPONSE(FieldGroup.RESPONSE, String.class, "The entire response encoded in Base64", "AsBase64"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public enum Protocol {HTTP, HTTPS}
.append("{'id':" + PARAMETERS + ",'name':'Parameters','defaultVisibleName':'Parameters','visibleName':'Parameters','preferredWidth':150,'readonly':true,'order':" + colOrder++ + ",'visible':false,'description':'" + StringEscapeUtils.escapeJson(PARAMETERS.getDescription()) + "'},")
.append("{'id':" + REFLECTED_PARAMS + ",'name':'ReflectedParams','defaultVisibleName':'Reflected Params','visibleName':'Reflected Params','preferredWidth':150,'readonly':true,'order':" + colOrder++ + ",'visible':true,'description':'" + StringEscapeUtils.escapeJson(REFLECTED_PARAMS.getDescription()) + "'},")
.append("{'id':" + REFLECTION_COUNT + ",'name':'ReflectionCount','defaultVisibleName':'Reflection Count','visibleName':'Reflection Count','preferredWidth':150,'readonly':true,'order':" + colOrder++ + ",'visible':false,'description':'" + StringEscapeUtils.escapeJson(REFLECTION_COUNT.getDescription()) + "'},")
.append("{'id':" + ORIGIN + ",'name':'origin','defaultVisibleName':'Origin header','visibleName':'Origin header','preferredWidth':150,'readonly':true,'order':" + colOrder++ + ",'visible':false,'description':'" + StringEscapeUtils.escapeJson(ORIGIN.getDescription()) + "'},")
.append("{'id':" + MIME_TYPE + ",'name':'MimeType','defaultVisibleName':'MIME type','visibleName':'MIME type','preferredWidth':100,'readonly':true,'order':" + colOrder++ + ",'visible':false,'description':'" + StringEscapeUtils.escapeJson(MIME_TYPE.getDescription()) + "'},")
.append("{'id':" + NEW_COOKIES + ",'name':'NewCookies','defaultVisibleName':'New Cookies','visibleName':'New Cookies','preferredWidth':125,'readonly':true,'order':" + colOrder++ + ",'visible':true,'description':'" + StringEscapeUtils.escapeJson(NEW_COOKIES.getDescription()) + "'},")
.append("{'id':" + REQUEST_TIME + ",'name':'RequestTime','defaultVisibleName':'Request Time','visibleName':'Request Time','preferredWidth':150,'readonly':true,'order':" + colOrder++ + ",'visible':true,'description':'" + StringEscapeUtils.escapeJson(REQUEST_TIME.getDescription()) + "'},")
Expand Down