unsupported
 <    aise error.ProgrammingError(b'status line not defined')

        if (
            self._bodybytes is None
            and self._bodygen is None
            and not self._bodywillwrite
        ):
            raise error.ProgrammingError(b'response body not defined')

        # RFC 7232 Section 4.1 states that a 304 MUST generate one of
        # {Cache-Control, Content-Location, Date, ETag, Expires, Vary}
        # and SHOULD NOT generate other headers unless they could be used
        # to guide cache updates. Furthermore, RFC 7230 Section 3.3.2
        # states that no response body can be issued. Content-Length can
        # be sent. But if it is present, it should be the size of the response
        # that wasn't transferred.
        if self.status.startswith(b'304 '):
            # setbodybytes('') will set C-L to 0. This doesn't conform with the
            # spec. So remove it.
            if self.headers.get(b'Content-Length') == b'0':
                del self.headers[b'Content-Length']

            # Strictly speaking, this is too strict. But until it causes
            # problems, let's be strict.
            badheaders = {
                k
                for k in self.headers.keys()
                if k.lower()
                not in (
                    b'date',
                    b'etag',
                    b'expires',
                    b'cache-control',
                    b'content-location',
                    b'content-security-policy',
                    b'vary',
                )
            }
            if badheaders:
                raise error.ProgrammingError(
                    b'illegal header on 304 response: %s'
                    % b', '.join(sorted(badheaders))
                )

            if self._bodygen is not None or self._bodywillwrite:
                raise error.ProgrammingError(
                    b"must use setbodybytes('') with 304 responses"
                )

        # Various HTTP clients (notably httplib) won't read the HTTP response
        # until the HTTP request has been sent in full. If servers (us) send a
        # response before the HTTP request has been fully sent, the connection
        # may deadlock because neither end is reading.
        #
        # We work around this by "draining" the request data before
        # sending any response in some conditions.
        drain = False
        close = False

        # If the client sent Expect: 100-continue, we assume it is smart enough
        # to deal with the server sending a response before reading the request.
        # (httplib doesn't do this.)
        if self._req.headers.get(b'Expect', b'').lower() == b'100-continue':
            pass
        # Only tend to request methods that have bodies. Strictly speaking,
        # we should sniff for a body. But this is fine for our existing
        # WSGI applications.
        elif self._req.method not in (b'POST', b'PUT'):
            pass
        else:
            # If we don't know how much data to read, there's no guarantee
            # that we can drain the request responsibly. The WSGI
            # specification only says that servers *should* ensure the
            # input stream doesn't overrun the actual request. So there's
            # no guarantee that reading until EOF won't corrupt the stream
            # state.
            if not isinstance(self._req.bodyfh, util.cappedreader):
                close = True
            else:
                # We /could/ only drain certain HTTP response codes. But 200 and
                # non-200 wire protocol responses both require draining. Since
                # we have a capped reader in place for all situations where we
                # drain, it is safe to read from that stream. We'll either do
                # a drain or no-op if we're already at EOF.
                drain = True

        if close:
            self.headers[b'Connection'] = b'Close'

        if drain:
            assert isinstance(self._req.bodyfh, util.cappedreader)
            while True:
                chunk = 