Skip to content

Commit

Permalink
Set hostname.
Browse files Browse the repository at this point in the history
  • Loading branch information
dma committed Jun 29, 2016
1 parent f62c77b commit 7c7561f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import com.google.common.io.BaseEncoding;
import com.google.common.net.InternetDomainName;

import com.subgraph.vega.api.http.requests.IHttpResponse;
import com.subgraph.vega.api.model.IWorkspace;
import com.subgraph.vega.api.model.alerts.IScanAlert;
Expand Down Expand Up @@ -141,13 +140,15 @@ public void publishAlert(String type, String key, String message,
Object... properties) {
debug("Publishing Alert: ("+ type +") ["+ request.getRequestLine().getUri() +"] ");
final IRequestLog requestLog = workspace.getRequestLog();

synchronized(scanInstance) {
if(key != null && scanInstance.hasAlertKey(key)) {
return;
}
final long requestId = requestLog.addRequestResponse(response);
final IScanAlert alert = scanInstance.createAlert(type, key, requestId);
final String hostname = response.getHost().getHostName();
alert.setDiscretionaryHostname(hostname);

for(int i = 0; (i + 1) < properties.length; i += 2) {
if(properties[i] instanceof String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.apache.http.client.methods.HttpUriRequest;

import com.google.common.net.InternetDomainName;

import com.subgraph.vega.api.crawler.ICrawlerResponseProcessor;
import com.subgraph.vega.api.http.requests.IHttpResponse;
import com.subgraph.vega.api.http.requests.IPageFingerprint;
Expand Down Expand Up @@ -295,6 +294,10 @@ public void publishAlert(String type, String key, String message, HttpRequest re
return;
final long requestId = requestLog.addRequestResponse(response);
final IScanAlert alert = scan.createAlert(type, key, requestId);
final String hostname = response.getHost().getHostName();

alert.setDiscretionaryHostname(hostname);

for(int i = 0; (i + 1) < properties.length; i += 2) {
if(properties[i] instanceof String) {
alert.setProperty((String) properties[i], properties[i + 1]);
Expand Down

0 comments on commit 7c7561f

Please sign in to comment.