Ticket #277 (new defect)

Opened 4 years ago

WSGIFilter does not handle combination of shortcut and RHS generator

Reported by: tseaver Owned by: ianb
Priority: normal Milestone: 1.4.1
Component: paste Version: svn-trunk
Severity: normal Keywords:
Cc:

Description

In WSGIFilter-0.1dev-r7189, the middleware's 'call' does not handle the following edge case correctly:

  • RHS application returns a generator, delaying call to 'replacement_start_response' until first 'app_iter' iteration.
  • When iterated, the RHS calls 'replacement_start_response' with a non-200 status (e.g., '302' for a login form).
  • WSGIFilter therefore decides to skip filtering, sets the 'shortcutted' flag, and returns the result of calling LHS 'start response'.
  • Iteration over 'app_iter' completes, but the 'captured' list has not been populated, and the (unnwanted) call to 'filter_output' raises.

Patch attached, which re-checks the 'shortcutted' flag after iterating.

Attachments

WSGIFilter-rhs_generator_shortcut.patch Download (0.9 KB) - added by tseaver 4 years ago.

Change History

Changed 4 years ago by tseaver

Note: See TracTickets for help on using tickets.