Ticket #5192: 5192_5.patch

File 5192_5.patch, 3.0 KB (added by sdsern, 4 years ago)
  • twisted/web/test/test_newclient.py

     
    16911691        self.clock.advance(TIMEOUT_100_CONTINUE + 1)
    16921692
    16931693        self.assertEqual(self.transport.value(), 'x' * 10)
     1694        self.assertEqual(self.protocol._firstResponseTimer.called, True)
     1695        self.assertEqual(self.protocol._firstResponseDeferred.called, False)
    16941696
    16951697        self.protocol.dataReceived(
    16961698            "HTTP/1.1 200 OK\r\n"
    16971699            "Content-Length: 0\r\n"
    16981700            "\r\n")
     1701   
     1702        self.assertEqual(self.protocol._firstResponseDeferred.called, True)
    16991703
    17001704        return d
    17011705
     
    17151719
    17161720        self.clock.advance(TIMEOUT_100_CONTINUE + 1)
    17171721
     1722        self.assertEqual(self.protocol._firstResponseTimer.called, True)
     1723        self.assertEqual(self.protocol._firstResponseDeferred.called, False)
     1724
    17181725        self.assertEqual(self.transport.value(), 'x' * 10)
    17191726
    17201727        self.protocol.dataReceived(
     
    17281735            "Content-length: 0\r\n"
    17291736            "\r\n")
    17301737
     1738        self.assertEqual(self.protocol._firstResponseDeferred.called, True)
     1739
    17311740        return d
    17321741
    17331742
  • twisted/web/_newclient.py

     
    574574
    575575
    576576    def _writeHeaders(self, transport, bodyFramingHeader):
     577        """
     578        Write this request's headers to the given transport and include
     579        the specified body framing header.
     580        """
    577581        hosts = self.headers.getRawHeaders('host', ())
    578582        if len(hosts) != 1:
    579583            raise BadHeaders("Exactly one Host header required")
    580584
    581585        # In the future, having the protocol version be a parameter to this
    582586        # method would probably be good.  It would be nice if this method
    583         # weren't limited to issueing HTTP/1.1 requests.
     587        # weren't limited to issuing HTTP/1.1 requests.
    584588        requestLines = []
    585589        requestLines.append(
    586590            '%s %s HTTP/1.1\r\n' % (self.method, self.uri))
     
    12381242class HTTP11ClientProtocol(Protocol):
    12391243    """
    12401244    L{HTTP11ClientProtocol} is an implementation of the HTTP 1.1 client
    1241     protocol. It supports as few features as possible.
     1245    protocol.  It supports as few features as possible.
    12421246
    12431247    @ivar _parser: After a request is issued, the L{HTTPClientParser} to
    12441248        which received data making up the response to that request is
     
    12771281        did not respond in time with a L{Response} (possibly because of a
    12781282        buggy server that doesn't implement expectations correctly).
    12791283
    1280     @ivar _firstResponseTimer: A L{Delayed} that fires after
     1284    @ivar _firstResponseTimer: A L{Deferred} that fires after
    12811285        TIMEOUT_100_CONTINUE seconds and forcefully sends the L{Request} body
    12821286        to the server.
    12831287