a bit more details for debug

Signed-off-by: olivier lamy <olamy@apache.org>
This commit is contained in:
olivier lamy 2017-04-25 21:43:37 +10:00
parent 91cc4675a1
commit c46c26948d
1 changed files with 15 additions and 5 deletions

View File

@ -239,16 +239,22 @@ public class RequestValidationInterceptor extends AbstractInterceptor implements
headerFound=true; headerFound=true;
log.debug("Origin Header URL found: {}", originUrl); log.debug("Origin Header URL found: {}", originUrl);
if (!targetUrl.getProtocol().equals(originUrl.getProtocol())) { if (!targetUrl.getProtocol().equals(originUrl.getProtocol())) {
log.warn("Origin Header Protocol does not match originUrl={}, targetUrl={}", originUrl, targetUrl); log.warn("Origin Header Protocol does not match originUrl={}, targetUrl={}", //
originUrl.getProtocol(), //
targetUrl.getProtocol());
return false; return false;
} }
if (!targetUrl.getHost().equals(originUrl.getHost())) { if (!targetUrl.getHost().equals(originUrl.getHost())) {
log.warn("Origin Header Host does not match originUrl={}, targetUrl={}",originUrl,targetUrl); log.warn("Origin Header Host does not match originUrl='{}', targetUrl='{}'",
originUrl.getProtocol(), //
targetUrl.getProtocol());
return false; return false;
} }
int originPort = getPort(originUrl); int originPort = getPort(originUrl);
if (targetPort != originPort) { if (targetPort != originPort) {
log.warn("Origin Header Port does not match originUrl={}, targetUrl={}",originUrl,targetUrl); log.warn("Origin Header Port does not match originUrl={}, targetUrl={}",
originUrl.getPort(),
targetUrl.getPort());
return false; return false;
} }
} catch (MalformedURLException ex) { } catch (MalformedURLException ex) {
@ -263,12 +269,16 @@ public class RequestValidationInterceptor extends AbstractInterceptor implements
headerFound=true; headerFound=true;
log.debug("Referer Header URL found: {}",refererUrl); log.debug("Referer Header URL found: {}",refererUrl);
if (!targetUrl.getHost().equals(refererUrl.getHost())) { if (!targetUrl.getHost().equals(refererUrl.getHost())) {
log.warn("Referer Header Host does not match refererUrl={}, targetUrl={}",refererUrl,targetUrl); log.warn("Referer Header Host does not match refererUrl='{}', targetUrl='{}'", //
refererUrl.getHost(), //
targetUrl.getHost());
return false; return false;
} }
int refererPort = getPort(refererUrl); int refererPort = getPort(refererUrl);
if (targetPort != refererPort) { if (targetPort != refererPort) {
log.warn("Referer Header Port does not match refererUrl={}, targetUrl={}",refererUrl,targetUrl); log.warn("Referer Header Port does not match refererUrl={}, targetUrl={}", //
refererUrl.getPort(),
targetUrl.getPort());
return false; return false;
} }
} catch (MalformedURLException ex) { } catch (MalformedURLException ex) {