PEP 333 says that the WSGI framework will call .close() on the iterator returned by a WSGI application once it's done, provided such a method exists. So, if our code wraps an iterator, then we have to call .close() on it once we're done with it. proxy_logging wasn't. Since WSGIContext gets it right, I looked at making proxy_logging use WSGIContext. However, WSGIContext is all about forcing the first chunk out of the iterator so that it can capture the final HTTP status and headers; it doesn't help if you want to look at every chunk. proxy_logging wants every chunk so it can count the bytes sent. This didn't hurt anything in Swift, but pconstantine was complaining in IRC that our failure to call .close() was goofing up some other middleware he had. Change-Id: Ic6ea0795ccef6cda2b5c6737697ef7d58eac9ab4
38 KiB
38 KiB