http() call containing header with no value causes AttributeError

Bug #181754 reported by Matthew Paul Thomas
2
Affects Status Importance Assigned to Milestone
Zope 3
Won't Fix
Undecided
Unassigned
zope.app.testing
Won't Fix
Undecided
Unassigned

Bug Description

It should be possible to use http() to test how well an application handles malformed HTTP requests -- such as a request containing an HTTP header that has no value.

Failed example:
    page_with_malformed_header = str(http(r"""
    GET /+fhqwhgads HTTP/1.1
    Referer:
    """))
Exception raised:
    Traceback (most recent call last):
      File "[...]/zope/testing/doctest.py", line 1256, in __run
        compileflags, 1) in test.globs
      File "<doctest notfound-error.txt[6]>", line 1, in ?
      File "[...]", line 47, in __call__
        return HTTPCaller.__call__(self, *args, **kw)
      File "[...]/zope/app/testing/functional.py", line 563, in __call__
        headers = [split_header(header)
      File "[...]/zope/app/testing/functional.py", line 480, in split_header
        return headerre.match(header).group(1, 2)
    AttributeError: 'NoneType' object has no attribute 'group'

Changed in zope3:
status: New → Won't Fix
Revision history for this message
Christian Theune (ctheune) wrote :

Malformed HTTP requests won't make it to the application as Zope needs to parse them already and I expect those to end in an HTTP 400/Bad request response without ever getting to the application.

Changed in zope.app.testing:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.