You are here

public function HttpblResponse::challengeFailureBlacklisted in http:BL 8

Build a response to a white-list challenge failure.

This is the response sent when local blacklisting is possible with storage enabled.

Parameters

string $ip: The IP address to evaluate.

string $return_date: A date formatted as time hence.

Return value

object $failureResponse A PRECONDITION FAILED (412) response.

Overrides HttpblResponseInterface::challengeFailureBlacklisted

File

src/HttpblResponse.php, line 117

Class

HttpblResponse
HttpblResponse builds the final response to request.

Namespace

Drupal\httpbl

Code

public function challengeFailureBlacklisted($ip, $return_date) {
  $honeypot = t(self::buildHoneypot());
  $message = new FormattableMarkup('<h1 class=httpbl>412 HTTP_PRECONDITION_FAILED</h1>Failed white-list request challenge; @ip has been blacklisted on this site for @return.@honeypot', [
    '@ip' => $ip,
    '@return' => $return_date,
    '@honeypot' => $honeypot,
  ]);
  $failureResponse = new SymfonyResponse($message, 412);
  return $failureResponse;
}