#27153: HttpResponseBase should check for valid HTTP status code
--------------------------------------+--------------------
     Reporter:  ryangallen            |      Owner:  nobody
         Type:  Cleanup/optimization  |     Status:  new
    Component:  HTTP handling         |    Version:  1.10
     Severity:  Normal                |   Keywords:
 Triage Stage:  Unreviewed            |  Has patch:  1
Easy pickings:  1                     |      UI/UX:  0
--------------------------------------+--------------------
 Currently, the HttpResponseBase class does not check for Type or Value
 Error on the HTTP status code. If a bad value such as a string is passed
 it, an exception is not thrown until it reaches:

 {{{
 File "django/http/utils.py", line 17, in conditional_content_removal
     if 100 <= response.status_code < 200 or response.status_code in (204,
 304):
 TypeError: unorderable types: int() <= str()
 }}}

 Proposed fix:
 - Valid status values in the form of a string should be coerced to an
 integer if possible.
 - Integer values less than 100 or greater than 599 should also be rejected
 based on [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html W3C
 Status Code Definitions RFC 2612]

--
Ticket URL: <https://code.djangoproject.com/ticket/27153>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.84e6f643a7c642a11f764e851d1b0131%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to