class Bane::Behaviors::Responders::HttpRefuseAllCredentials

Sends an HTTP 401 response (Unauthorized) for every request. This attempts to mimic an HTTP server by reading a line (the request) and then sending the response. This behavior responds to all incoming request URLs on the running port.

Constants

UNAUTHORIZED_RESPONSE_BODY

Public Instance Methods

serve(io) click to toggle source
# File lib/bane/behaviors/responders/http_refuse_all_credentials.rb, line 24
def serve(io)
  io.gets # Read the request before responding
  response = NaiveHttpResponse.new(401, "Unauthorized", "text/html", UNAUTHORIZED_RESPONSE_BODY)
  io.write(response.to_s)
end