Is it possible to deny requests automatically from all ips that request bad malformed requests 400

is it possible to deny requests automatically from all ips that request
bad
malformed requests 400

http://pastie.org/713666