Last active
August 29, 2015 14:16
-
-
Save kinkerl/88f9015108185db8ddd8 to your computer and use it in GitHub Desktop.
Django middleware to discard to long urls to prevent strange injections and errors with inferior databases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.http import Http404 | |
class GracefullDiscardLongURLMiddleware: | |
def process_request(self, request): # pylint: disable-msg=R0201 | |
if len(request.path) >= 255: | |
raise Http404 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment