示例#1
0
 /**
  * @todo Hook up $httpCode
  * @param wfWAFBlockXSSException $e
  * @param int $httpCode
  */
 public function blockXSSAction($e, $httpCode = 403, $redirect = false)
 {
     $this->getStorageEngine()->logAttack($e->getFailedRules(), $e->getParamKey(), $e->getParamValue(), $e->getRequest(), $e->getRequest()->getMetadata());
     if ($redirect) {
         wfWAFUtils::redirect($redirect);
         // exits
     }
     if ($httpCode == 503) {
         wfWAFUtils::statusHeader(503);
         if ($secsToGo = $e->getRequest()->getMetadata('503Time')) {
             header('Retry-After: ' . $secsToGo);
         }
         exit($this->getUnavailableMessage($e->getRequest()->getMetadata('503Reason')));
     }
     header('HTTP/1.0 403 Forbidden');
     exit($this->getBlockedMessage());
 }