use of org.apache.commons.httpclient.URI in project zaproxy by zaproxy.
the class FilterLogGetQuery method onHttpRequestSend.
@Override
public void onHttpRequestSend(HttpMessage httpMessage) {
HttpRequestHeader reqHeader = httpMessage.getRequestHeader();
if (reqHeader != null && reqHeader.isText() && !reqHeader.isImage()) {
if (reqHeader.getMethod().equalsIgnoreCase(HttpRequestHeader.GET)) {
try {
URI uri = reqHeader.getURI();
// ZAP: Removed unused variable (int pos).
String firstline;
URI newURI = (URI) uri.clone();
String query = newURI.getQuery();
if (query != null) {
newURI.setQuery(null);
firstline = newURI.toString();
// ZAP: Added type arguments.
Hashtable<String, String> param = parseParameter(query);
writeLogFile(firstline, param);
} else {
firstline = uri.toString();
writeLogFile(firstline, null);
}
} catch (Exception aa) {
logger.error(aa.getMessage(), aa);
}
}
}
}
use of org.apache.commons.httpclient.URI in project zaproxy by zaproxy.
the class VariantODataIdQuery method setMessage.
@Override
public void setMessage(HttpMessage msg) {
URI uri = msg.getRequestHeader().getURI();
parse(uri);
}
use of org.apache.commons.httpclient.URI in project zaproxy by zaproxy.
the class VariantURLPath method setParameter.
/**
*
* @param msg
* @param originalPair
* @param name
* @param value
* @param escaped
* @return
*/
private String setParameter(HttpMessage msg, NameValuePair originalPair, String name, String value, boolean escaped) {
try {
URI uri = msg.getRequestHeader().getURI();
String[] paths = msg.getRequestHeader().getURI().getPath().toString().split("/");
if (originalPair.getPosition() < paths.length) {
String encodedValue = (escaped) ? value : getEscapedValue(value);
paths[originalPair.getPosition()] = encodedValue;
String path = StringUtils.join(paths, "/");
try {
uri.setEscapedPath(path);
} catch (URIException e) {
// Looks like it wasnt escaped after all
uri.setPath(path);
}
}
} catch (URIException e) {
logger.error(e.getMessage(), e);
}
return value;
}
use of org.apache.commons.httpclient.URI in project zaproxy by zaproxy.
the class PopupMenuShowAlerts method isButtonEnabledForHistoryReference.
@Override
public boolean isButtonEnabledForHistoryReference(HistoryReference href) {
List<Alert> alerts;
if (href.getSiteNode() != null) {
alerts = href.getSiteNode().getAlerts();
} else {
alerts = href.getAlerts();
}
URI hrefURI = href.getURI();
List<PopupMenuShowAlert> alertList = new ArrayList<>(alerts.size());
for (Alert alert : alerts) {
// Just show ones for this node
if (hrefURI != null && !alert.getUri().equals(hrefURI.toString())) {
continue;
}
final PopupMenuShowAlert menuItem = new PopupMenuShowAlert(alert.getName(), alert);
menuItem.setIcon(alert.getIcon());
alertList.add(menuItem);
}
Collections.sort(alertList);
for (PopupMenuShowAlert pmsa : alertList) {
this.add(pmsa);
}
return (alertList.size() > 0);
}
use of org.apache.commons.httpclient.URI in project zaproxy by zaproxy.
the class Spider method addSeed.
/* SPIDER Related */
/**
* Adds a new seed for the Spider.
*
* @param msg the message used for seed. The request URI is used from the Request Header
*/
public void addSeed(HttpMessage msg) {
URI uri = msg.getRequestHeader().getURI();
addSeed(uri);
}
Aggregations